MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / MapBernstein

Function MapBernstein

comp/webgui.cpp:174–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174vector<string> MapBernstein(FlatTensor<3, double> input, ngfem::ELEMENT_TYPE eltype,
175 int order, int n_components) {
176 auto [ne, nip, comps] = input.Shape();
177 Tensor<3, double> output(nip, ne, comps);
178 Tensor<3, float> output_f(nip, ne, comps);
179 auto trafo = GetIBernsteinBasis(eltype, order);
180
181 for (size_t i = 0; i < ne; i++)
182 output(STAR, i, STAR) = trafo * input(i, STAR, STAR);
183
184 // convert double to float
185 auto n = output.GetTotalSize();
186 for (auto i : Range(n)) output_f.Data()[i] = output.Data()[i];
187
188 vector<string> ret;
189 for (auto i : Range(nip)) {
190 auto vals = output_f(i, STAR, STAR);
191 ret.push_back(base64_encode(FlatArray<unsigned char>(
192 vals.Height() * vals.Width() * sizeof(vals(0, 0)),
193 reinterpret_cast<unsigned char *>(vals.Data()))));
194 }
195 return ret;
196}
197
198vector<string> GenerateWireframeData( shared_ptr<MeshAccess> ma,
199 shared_ptr<CoefficientFunction> cf,

Callers 3

GenerateWireframeDataFunction · 0.85
GenerateEdgeDataFunction · 0.85
GenerateSurfaceDataFunction · 0.85

Calls 8

GetIBernsteinBasisFunction · 0.85
base64_encodeFunction · 0.85
RangeFunction · 0.50
ShapeMethod · 0.45
GetTotalSizeMethod · 0.45
DataMethod · 0.45
HeightMethod · 0.45
WidthMethod · 0.45

Tested by

no test coverage detected