| 172 | } |
| 173 | |
| 174 | vector<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 | |
| 198 | vector<string> GenerateWireframeData( shared_ptr<MeshAccess> ma, |
| 199 | shared_ptr<CoefficientFunction> cf, |
no test coverage detected