30 gismo::condition_type::type
type;
57template <
short_t d,
class T>
65 nlohmann::json
to_json(
const std::string &patch,
const std::string &component,
66 const std::string &attribute)
const override {
68 if (component ==
"solution") {
70 if (patch ==
"" && attribute ==
"") {
76 else if (patch !=
"") {
79 std::size_t patchIndex(0);
82 patchIndex = stoi(patch);
85 return R
"({ INVALID REQUEST })"_json;
89 return R
"({ INVALID REQUEST })"_json;
91 if (attribute ==
"") {
101 if (attribute ==
"degrees") {
102 json[
"degrees"] = nlohmann::json::array();
104 for (std::size_t i = 0; i <
solution_.patch(patchIndex).parDim(); ++i)
105 json[
"degrees"].push_back(
solution_.patch(patchIndex).degree(i));
108 else if (attribute ==
"geoDim")
109 json[
"geoDim"] =
solution_.patch(patchIndex).geoDim();
111 else if (attribute ==
"parDim")
112 json[
"parDim"] =
solution_.patch(patchIndex).parDim();
114 else if (attribute ==
"ncoeffs") {
115 json[
"ncoeffs"] = nlohmann::json::array();
118 dynamic_cast<const gismo::gsBSpline<T> *
>(&
solution_.patch(patchIndex)))
119 for (std::size_t i = 0; i < bspline->parDim(); ++i)
120 json[
"ncoeffs"].push_back(bspline->basis().size(i));
121 else if (
auto bspline =
dynamic_cast<const gismo::gsTensorBSpline<d, T> *
>(
123 for (std::size_t i = 0; i < bspline->parDim(); ++i)
124 json[
"ncoeffs"].push_back(bspline->basis().size(i));
126 return R
"({ INVALID REQUEST })"_json;
129 else if (attribute ==
"nknots") {
130 json[
"nknots"] = nlohmann::json::array();
133 dynamic_cast<const gismo::gsBSpline<T> *
>(&
solution_.patch(patchIndex)))
134 for (std::size_t i = 0; i < bspline->parDim(); ++i)
135 json[
"nknots"].push_back(bspline->knots(i).size());
136 else if (
auto bspline =
dynamic_cast<const gismo::gsTensorBSpline<d, T> *
>(
138 for (std::size_t i = 0; i < bspline->parDim(); ++i)
139 json[
"nknots"].push_back(bspline->knots(i).size());
141 return R
"({ INVALID REQUEST })"_json;
144 else if (attribute ==
"coeffs") {
147 dynamic_cast<const gismo::gsBSpline<T> *
>(&
solution_.patch(patchIndex)))
149 else if (
auto bspline =
dynamic_cast<const gismo::gsTensorBSpline<d, T> *
>(
153 return R
"({ INVALID REQUEST })"_json;
157 else if (attribute ==
"knots") {
158 json[
"knots"] = nlohmann::json::array();
161 dynamic_cast<const gismo::gsBSpline<T> *
>(&
solution_.patch(patchIndex)))
162 for (std::size_t i = 0; i < bspline->parDim(); ++i)
163 json[
"knots"].push_back(bspline->knots(i));
164 else if (
auto bspline =
dynamic_cast<const gismo::gsTensorBSpline<d, T> *
>(
166 for (std::size_t i = 0; i < bspline->parDim(); ++i)
167 json[
"knots"].push_back(bspline->knots(i));
169 return R
"({ INVALID REQUEST })"_json;
174 return R
"({ INVALID REQUEST })"_json;
181 return R
"({ INVALID REQUEST })"_json;
G+Smo geometry model.
Definition GismoGeometryModel.hpp:33
nlohmann::json to_json(const std::string &patch, const std::string &component, const std::string &attribute) const override
Serializes the model to JSON.
Definition GismoGeometryModel.hpp:334
GismoGeometryModel()=default
Default constructor.
G+Smo PDE model.
Definition GismoPdeModel.hpp:58
gismo::gsMultiPatch< T > solution_
Solution.
Definition GismoPdeModel.hpp:190
nlohmann::json to_json(const std::string &patch, const std::string &component, const std::string &attribute) const override
Serializes the model to JSON.
Definition GismoPdeModel.hpp:65
auto to_json(const torch::TensorAccessor< T, N > &accessor)
Converts a torch::TensorAccessor object to a JSON object.
Definition serialize.hpp:41
gismo::condition_type::type type
Boundary type.
Definition GismoPdeModel.hpp:30
bool isParametric
Flag that indicates whether the boundary conditions is imposed on the parametric of physical domain.
Definition GismoPdeModel.hpp:34
bool isParametric
Flag that indicates whether the function expression is imposed on the parametric of physical domain.
Definition GismoPdeModel.hpp:49
std::map< int, std::map< int, GismoFunction< T > > > GismoFunctionMap
G+Smo function look-up table.
Definition GismoPdeModel.hpp:54
gismo::gsFunctionExpr< T > function
Function expression.
Definition GismoPdeModel.hpp:45
gismo::gsFunctionExpr< T > function
Boundary function expression.
Definition GismoPdeModel.hpp:27
std::map< int, std::map< int, GismoBoundaryCondition< T > > > GismoBoundaryConditionMap
G+Smo boundary condition look-up table.
Definition GismoPdeModel.hpp:39
G+Smo boundary condition POD.
Definition GismoPdeModel.hpp:25
G+Smo function POD.
Definition GismoPdeModel.hpp:43
Definition boundary.hpp:22