FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
rumpf_trafo.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
9#include <kernel/geometry/conformal_mesh.hpp>
10#include <kernel/lafem/dense_vector.hpp>
11#include <kernel/lafem/dense_vector_blocked.hpp>
12#include <kernel/trafo/standard/mapping.hpp>
13
14namespace FEAT
15{
16 namespace Meshopt
17 {
34#ifndef DOXYGEN
35 template<typename TrafoType_, typename DataType_>
36 struct RumpfTrafo;
37 // Note:
38 // The following block serves as an element interface documentation and is therefore only
39 // visible to doxygen. The actual functionality has to be supplied by the implementation
40 // of specializations in TrafoType_.
41#else
42 template<typename TrafoType_, typename DataType_>
44 {
46 typedef DataType_ DataType;
48 typedef TrafoType_ TrafoType;
50 typedef typename TrafoType::ShapeType ShapeType;
52 typedef typename TrafoType::MeshType MeshType;
61
89 static DataType_ compute_sum_det(const VectorType& coords_, const MeshType& mesh_);
90
108 static void compute_h(ScalarVectorType& h_, const ScalarVectorType& lambda_, const DataType& sum_det_);
109
125 static void compute_grad_det(Tx& grad, const Tx& x);
126
143 static void compute_grad_sum_det(VectorType& grad_, const VectorType& coords_, const MeshType& mesh_);
144
157 static MatTensorType compute_mat_tensor(const Tx& x, const DataType_& h);
158 }; // struct RumpfTrafo;
159#endif
160
162
171 template<typename DataType_>
172 struct RumpfTrafo<Trafo::Standard::Mapping<Geometry::ConformalMesh<Shape::Hypercube<2>,2,DataType_>>,DataType_>
173 {
174 public:
178 typedef DataType_ DataType;
180 typedef typename TrafoType::ShapeType ShapeType;
182 typedef typename TrafoType::MeshType MeshType;
191
192 private:
196 static DataType compute_det(Tx& x)
197 {
198 return (x(0,0) * x(1,1) - x(0,0) * x(2,1) - x(0,1) * x(1,0) + x(0,1) * x(2,0)
199 + x(1,0) * x(3,1) - x(1,1) * x(3,0) - x(2,0) * x(3,1) + x(2,1) * x(3,0)) / DataType(2);
200 }
201
205 static void compute_grad_det(Tx& grad, const Tx& x)
206 {
207 grad(0,0) = ( x(1,1) - x(2,1)) / DataType(2);
208 grad(0,1) = (-x(1,0) + x(2,0)) / DataType(2);
209 grad(1,0) = (-x(0,1) + x(3,1)) / DataType(2);
210 grad(1,1) = ( x(0,0) - x(3,0)) / DataType(2);
211 grad(2,0) = ( x(0,1) - x(3,1)) / DataType(2);
212 grad(2,1) = (-x(0,0) + x(3,0)) / DataType(2);
213 grad(3,0) = (-x(1,1) + x(2,1)) / DataType(2);
214 grad(3,1) = ( x(1,0) - x(2,0)) / DataType(2);
215 }
216
217 public:
221 static void compute_h(ScalarVectorType& h_, const ScalarVectorType& lambda_, const DataType& sum_det_)
222 {
223 DataType_ exponent = DataType_(1)/DataType_(MeshType::world_dim);
224
225 Memory::TypedView<DataType_> vh = h_.elements_view_w();
226 const Memory::TypedView<DataType_> vl = lambda_.elements_view_r();
227 for(Index cell(0); cell < h_.size(); ++cell)
228 {
229 // For hypercubes, h is half the refence cell's edge length
230 vh[cell] = DataType(0.5)*Math::pow(vl(cell)*sum_det_,exponent);
231 }
232 }
233
237 static DataType_ compute_sum_det(const VectorType& coords_, const MeshType& mesh_)
238 {
239 // This will hold the coordinates for one element for passing to other routines
240 Tiny::Matrix <DataType_, Shape::FaceTraits<ShapeType,0>::count, MeshType::world_dim> x;
241
242 // Index set for local/global numbering
243 const auto& idx = mesh_.template get_index_set<ShapeType::dimension,0>();
244
245 DataType sum_det(0);
246 const auto vc = coords_.elements_view_r();
247 for(Index cell(0); cell < mesh_.get_num_entities(ShapeType::dimension); ++cell)
248 {
249 // Get local coordinates
250 for(int j(0); j < Shape::FaceTraits<ShapeType,0>::count; ++j)
251 {
252 x[j] = vc(idx(cell,j));
253 }
254
255 sum_det += compute_det(x);
256 }
257
258 return sum_det;
259 }
260
264 static void compute_grad_sum_det(VectorType& grad_, const VectorType& coords_, const MeshType& mesh_)
265 {
266 // This will hold the coordinates for one element for passing to other routines
267 Tx x(DataType_(0));
268
269 // Index set for local/global numbering
270 const auto& idx = mesh_.template get_index_set<ShapeType::dimension,0>();
271
272 Tx local_grad(DataType_(0));
273
274 grad_.format();
275 auto vg = grad_.elements_view_rw();
276 const auto vc = coords_.elements_view_r();
277
278 for(Index cell(0); cell < mesh_.get_num_entities(ShapeType::dimension); ++cell)
279 {
280 // Get local coordinates
281 for(int j(0); j < Shape::FaceTraits<ShapeType,0>::count; ++j)
282 {
283 x[j] = vc(idx(cell,j));
284 }
285
286 compute_grad_det(local_grad, x);
287
288 for(int j(0); j < Shape::FaceTraits<ShapeType,0>::count; ++j)
289 {
290 vg[idx(cell, j)] += local_grad[j];
291 }
292
293 }
294 } // compute_grad_sum_det
295
299 static MatTensorType compute_mat_tensor(const Tx& DOXY(x), const DataType_& h)
300 {
301 MatTensorType mat_tensor(DataType_(0));
302 DataType scal(DataType(1)/h);
303
304 for(int d(0); d < MeshType::world_dim; ++d)
305 {
306 mat_tensor(d,d) = scal;
307 }
308
309 return mat_tensor;
310 }
311
312 }; // RumpfTrafo<Hypercube<2>>
313
323 template<typename DataType_>
324 struct RumpfTrafo<Trafo::Standard::Mapping<Geometry::ConformalMesh<Shape::Hypercube<3>,3,DataType_>>,DataType_>
325 {
326 public:
328 typedef Trafo::Standard::Mapping<Geometry::ConformalMesh<Shape::Hypercube<3>,3,DataType_>> TrafoType;
330 typedef DataType_ DataType;
332 typedef typename TrafoType::ShapeType ShapeType;
334 typedef typename TrafoType::MeshType MeshType;
336 typedef Tiny::Matrix<DataType_, Shape::FaceTraits<ShapeType,0>::count, MeshType::world_dim> Tx;
338 typedef Tiny::Matrix<DataType_, MeshType::world_dim, MeshType::world_dim> MatTensorType;
340 typedef LAFEM::DenseVector<DataType, Index> ScalarVectorType;
342 typedef LAFEM::DenseVectorBlocked<DataType, Index, MeshType::world_dim> VectorType;
343
344 private:
348 static DataType compute_det(Tx& x)
349 {
350 return (-x(0,0) * x(1,1) * x(2,2) - x(0,0) * x(1,1) * x(3,2) + x(0,0) * x(1,1) * x(4,2) + x(0,0) * x(1,1) * x(5,2) + x(0,0) * x(1,2) * x(2,1) + x(0,0) * x(1,2) * x(3,1) - x(0,0) * x(1,2) * x(4,1) - x(0,0) * x(1,2) * x(5,1) + x(0,0) * x(2,1) * x(3,2) - x(0,0) * x(2,1) * x(4,2) - x(0,0) * x(2,1) * x(6,2) - x(0,0) * x(2,2) * x(3,1) + x(0,0) * x(2,2) * x(4,1) + x(0,0) * x(2,2) * x(6,1) - x(0,0) * x(4,1) * x(5,2) + x(0,0) * x(4,1) * x(6,2) + x(0,0) * x(4,2) * x(5,1) - x(0,0) * x(4,2) * x(6,1) + x(0,1) * x(1,0) * x(2,2) + x(0,1) * x(1,0) * x(3,2) - x(0,1) * x(1,0) * x(4,2) - x(0,1) * x(1,0) * x(5,2) - x(0,1) * x(1,2) * x(2,0) - x(0,1) * x(1,2) * x(3,0) + x(0,1) * x(1,2) * x(4,0) + x(0,1) * x(1,2) * x(5,0) - x(0,1) * x(2,0) * x(3,2) + x(0,1) * x(2,0) * x(4,2) + x(0,1) * x(2,0) * x(6,2) + x(0,1) * x(2,2) * x(3,0) - x(0,1) * x(2,2) * x(4,0) - x(0,1) * x(2,2) * x(6,0) + x(0,1) * x(4,0) * x(5,2) - x(0,1) * x(4,0) * x(6,2) - x(0,1) * x(4,2) * x(5,0) + x(0,1) * x(4,2) * x(6,0) - x(0,2) * x(1,0) * x(2,1) - x(0,2) * x(1,0) * x(3,1) + x(0,2) * x(1,0) * x(4,1) + x(0,2) * x(1,0) * x(5,1) + x(0,2) * x(1,1) * x(2,0) + x(0,2) * x(1,1) * x(3,0) - x(0,2) * x(1,1) * x(4,0) - x(0,2) * x(1,1) * x(5,0) + x(0,2) * x(2,0) * x(3,1) - x(0,2) * x(2,0) * x(4,1) - x(0,2) * x(2,0) * x(6,1) - x(0,2) * x(2,1) * x(3,0) + x(0,2) * x(2,1) * x(4,0) + x(0,2) * x(2,1) * x(6,0) - x(0,2) * x(4,0) * x(5,1) + x(0,2) * x(4,0) * x(6,1) + x(0,2) * x(4,1) * x(5,0) - x(0,2) * x(4,1) * x(6,0) + x(1,0) * x(2,1) * x(3,2) - x(1,0) * x(2,2) * x(3,1) + x(1,0) * x(3,1) * x(5,2) + x(1,0) * x(3,1) * x(7,2) - x(1,0) * x(3,2) * x(5,1) - x(1,0) * x(3,2) * x(7,1) - x(1,0) * x(4,1) * x(5,2) + x(1,0) * x(4,2) * x(5,1) - x(1,0) * x(5,1) * x(7,2) + x(1,0) * x(5,2) * x(7,1) - x(1,1) * x(2,0) * x(3,2) + x(1,1) * x(2,2) * x(3,0) - x(1,1) * x(3,0) * x(5,2) - x(1,1) * x(3,0) * x(7,2) + x(1,1) * x(3,2) * x(5,0) + x(1,1) * x(3,2) * x(7,0) + x(1,1) * x(4,0) * x(5,2) - x(1,1) * x(4,2) * x(5,0) + x(1,1) * x(5,0) * x(7,2) - x(1,1) * x(5,2) * x(7,0) + x(1,2) * x(2,0) * x(3,1) - x(1,2) * x(2,1) * x(3,0) + x(1,2) * x(3,0) * x(5,1) + x(1,2) * x(3,0) * x(7,1) - x(1,2) * x(3,1) * x(5,0) - x(1,2) * x(3,1) * x(7,0) - x(1,2) * x(4,0) * x(5,1) + x(1,2) * x(4,1) * x(5,0) - x(1,2) * x(5,0) * x(7,1) + x(1,2) * x(5,1) * x(7,0) - x(2,0) * x(3,1) * x(6,2) - x(2,0) * x(3,1) * x(7,2) + x(2,0) * x(3,2) * x(6,1) + x(2,0) * x(3,2) * x(7,1) + x(2,0) * x(4,1) * x(6,2) - x(2,0) * x(4,2) * x(6,1) + x(2,0) * x(6,1) * x(7,2) - x(2,0) * x(6,2) * x(7,1) + x(2,1) * x(3,0) * x(6,2) + x(2,1) * x(3,0) * x(7,2) - x(2,1) * x(3,2) * x(6,0) - x(2,1) * x(3,2) * x(7,0) - x(2,1) * x(4,0) * x(6,2) + x(2,1) * x(4,2) * x(6,0) - x(2,1) * x(6,0) * x(7,2) + x(2,1) * x(6,2) * x(7,0) - x(2,2) * x(3,0) * x(6,1) - x(2,2) * x(3,0) * x(7,1) + x(2,2) * x(3,1) * x(6,0) + x(2,2) * x(3,1) * x(7,0) + x(2,2) * x(4,0) * x(6,1) - x(2,2) * x(4,1) * x(6,0) + x(2,2) * x(6,0) * x(7,1) - x(2,2) * x(6,1) * x(7,0) - x(3,0) * x(5,1) * x(7,2) + x(3,0) * x(5,2) * x(7,1) + x(3,0) * x(6,1) * x(7,2) - x(3,0) * x(6,2) * x(7,1) + x(3,1) * x(5,0) * x(7,2) - x(3,1) * x(5,2) * x(7,0) - x(3,1) * x(6,0) * x(7,2) + x(3,1) * x(6,2) * x(7,0) - x(3,2) * x(5,0) * x(7,1) + x(3,2) * x(5,1) * x(7,0) + x(3,2) * x(6,0) * x(7,1) - x(3,2) * x(6,1) * x(7,0) + x(4,0) * x(5,1) * x(6,2) + x(4,0) * x(5,1) * x(7,2) - x(4,0) * x(5,2) * x(6,1) - x(4,0) * x(5,2) * x(7,1) - x(4,0) * x(6,1) * x(7,2) + x(4,0) * x(6,2) * x(7,1) - x(4,1) * x(5,0) * x(6,2) - x(4,1) * x(5,0) * x(7,2) + x(4,1) * x(5,2) * x(6,0) + x(4,1) * x(5,2) * x(7,0) + x(4,1) * x(6,0) * x(7,2) - x(4,1) * x(6,2) * x(7,0) + x(4,2) * x(5,0) * x(6,1) + x(4,2) * x(5,0) * x(7,1) - x(4,2) * x(5,1) * x(6,0) - x(4,2) * x(5,1) * x(7,0) - x(4,2) * x(6,0) * x(7,1) + x(4,2) * x(6,1) * x(7,0) - x(5,0) * x(6,1) * x(7,2) + x(5,0) * x(6,2) * x(7,1) + x(5,1) * x(6,0) * x(7,2) - x(5,1) * x(6,2) * x(7,0) - x(5,2) * x(6,0) * x(7,1) + x(5,2) * x(6,1) * x(7,0))/DataType(12);
351 }
352
356 static void compute_grad_det(Tx& grad, const Tx& x)
357 {
358 grad(0,0) = -x(1,1) * x(2,2) - x(1,1) * x(3,2) + x(1,1) * x(4,2) + x(1,1) * x(5,2) + x(1,2) * x(2,1) + x(1,2) * x(3,1) - x(1,2) * x(4,1) - x(1,2) * x(5,1) + x(2,1) * x(3,2) - x(2,1) * x(4,2) - x(2,1) * x(6,2) - x(2,2) * x(3,1) + x(2,2) * x(4,1) + x(2,2) * x(6,1) - x(4,1) * x(5,2) + x(4,1) * x(6,2) + x(4,2) * x(5,1) - x(4,2) * x(6,1);
359 grad(0,1) = x(1,0) * x(2,2) + x(1,0) * x(3,2) - x(1,0) * x(4,2) - x(1,0) * x(5,2) - x(1,2) * x(2,0) - x(1,2) * x(3,0) + x(1,2) * x(4,0) + x(1,2) * x(5,0) - x(2,0) * x(3,2) + x(2,0) * x(4,2) + x(2,0) * x(6,2) + x(2,2) * x(3,0) - x(2,2) * x(4,0) - x(2,2) * x(6,0) + x(4,0) * x(5,2) - x(4,0) * x(6,2) - x(4,2) * x(5,0) + x(4,2) * x(6,0);
360 grad(0,2) = -x(1,0) * x(2,1) - x(1,0) * x(3,1) + x(1,0) * x(4,1) + x(1,0) * x(5,1) + x(1,1) * x(2,0) + x(1,1) * x(3,0) - x(1,1) * x(4,0) - x(1,1) * x(5,0) + x(2,0) * x(3,1) - x(2,0) * x(4,1) - x(2,0) * x(6,1) - x(2,1) * x(3,0) + x(2,1) * x(4,0) + x(2,1) * x(6,0) - x(4,0) * x(5,1) + x(4,0) * x(6,1) + x(4,1) * x(5,0) - x(4,1) * x(6,0);
361
362 grad(1,0) = x(0,1) * x(2,2) + x(0,1) * x(3,2) - x(0,1) * x(4,2) - x(0,1) * x(5,2) - x(0,2) * x(2,1) - x(0,2) * x(3,1) + x(0,2) * x(4,1) + x(0,2) * x(5,1) + x(2,1) * x(3,2) - x(2,2) * x(3,1) + x(3,1) * x(5,2) + x(3,1) * x(7,2) - x(3,2) * x(5,1) - x(3,2) * x(7,1) - x(4,1) * x(5,2) + x(4,2) * x(5,1) - x(5,1) * x(7,2) + x(5,2) * x(7,1);
363 grad(1,1) = -x(0,0) * x(2,2) - x(0,0) * x(3,2) + x(0,0) * x(4,2) + x(0,0) * x(5,2) + x(0,2) * x(2,0) + x(0,2) * x(3,0) - x(0,2) * x(4,0) - x(0,2) * x(5,0) - x(2,0) * x(3,2) + x(2,2) * x(3,0) - x(3,0) * x(5,2) - x(3,0) * x(7,2) + x(3,2) * x(5,0) + x(3,2) * x(7,0) + x(4,0) * x(5,2) - x(4,2) * x(5,0) + x(5,0) * x(7,2) - x(5,2) * x(7,0);
364 grad(1,2) = x(0,0) * x(2,1) + x(0,0) * x(3,1) - x(0,0) * x(4,1) - x(0,0) * x(5,1) - x(0,1) * x(2,0) - x(0,1) * x(3,0) + x(0,1) * x(4,0) + x(0,1) * x(5,0) + x(2,0) * x(3,1) - x(2,1) * x(3,0) + x(3,0) * x(5,1) + x(3,0) * x(7,1) - x(3,1) * x(5,0) - x(3,1) * x(7,0) - x(4,0) * x(5,1) + x(4,1) * x(5,0) - x(5,0) * x(7,1) + x(5,1) * x(7,0);
365
366 grad(2,0) = -x(0,1) * x(1,2) - x(0,1) * x(3,2) + x(0,1) * x(4,2) + x(0,1) * x(6,2) + x(0,2) * x(1,1) + x(0,2) * x(3,1) - x(0,2) * x(4,1) - x(0,2) * x(6,1) - x(1,1) * x(3,2) + x(1,2) * x(3,1) - x(3,1) * x(6,2) - x(3,1) * x(7,2) + x(3,2) * x(6,1) + x(3,2) * x(7,1) + x(4,1) * x(6,2) - x(4,2) * x(6,1) + x(6,1) * x(7,2) - x(6,2) * x(7,1);
367 grad(2,1) = x(0,0) * x(1,2) + x(0,0) * x(3,2) - x(0,0) * x(4,2) - x(0,0) * x(6,2) - x(0,2) * x(1,0) - x(0,2) * x(3,0) + x(0,2) * x(4,0) + x(0,2) * x(6,0) + x(1,0) * x(3,2) - x(1,2) * x(3,0) + x(3,0) * x(6,2) + x(3,0) * x(7,2) - x(3,2) * x(6,0) - x(3,2) * x(7,0) - x(4,0) * x(6,2) + x(4,2) * x(6,0) - x(6,0) * x(7,2) + x(6,2) * x(7,0);
368 grad(2,2) = -x(0,0) * x(1,1) - x(0,0) * x(3,1) + x(0,0) * x(4,1) + x(0,0) * x(6,1) + x(0,1) * x(1,0) + x(0,1) * x(3,0) - x(0,1) * x(4,0) - x(0,1) * x(6,0) - x(1,0) * x(3,1) + x(1,1) * x(3,0) - x(3,0) * x(6,1) - x(3,0) * x(7,1) + x(3,1) * x(6,0) + x(3,1) * x(7,0) + x(4,0) * x(6,1) - x(4,1) * x(6,0) + x(6,0) * x(7,1) - x(6,1) * x(7,0);
369
370 grad(3,0) = -x(0,1) * x(1,2) + x(0,1) * x(2,2) + x(0,2) * x(1,1) - x(0,2) * x(2,1) + x(1,1) * x(2,2) - x(1,1) * x(5,2) - x(1,1) * x(7,2) - x(1,2) * x(2,1) + x(1,2) * x(5,1) + x(1,2) * x(7,1) + x(2,1) * x(6,2) + x(2,1) * x(7,2) - x(2,2) * x(6,1) - x(2,2) * x(7,1) - x(5,1) * x(7,2) + x(5,2) * x(7,1) + x(6,1) * x(7,2) - x(6,2) * x(7,1);
371 grad(3,1) = x(0,0) * x(1,2) - x(0,0) * x(2,2) - x(0,2) * x(1,0) + x(0,2) * x(2,0) - x(1,0) * x(2,2) + x(1,0) * x(5,2) + x(1,0) * x(7,2) + x(1,2) * x(2,0) - x(1,2) * x(5,0) - x(1,2) * x(7,0) - x(2,0) * x(6,2) - x(2,0) * x(7,2) + x(2,2) * x(6,0) + x(2,2) * x(7,0) + x(5,0) * x(7,2) - x(5,2) * x(7,0) - x(6,0) * x(7,2) + x(6,2) * x(7,0);
372 grad(3,2) = -x(0,0) * x(1,1) + x(0,0) * x(2,1) + x(0,1) * x(1,0) - x(0,1) * x(2,0) + x(1,0) * x(2,1) - x(1,0) * x(5,1) - x(1,0) * x(7,1) - x(1,1) * x(2,0) + x(1,1) * x(5,0) + x(1,1) * x(7,0) + x(2,0) * x(6,1) + x(2,0) * x(7,1) - x(2,1) * x(6,0) - x(2,1) * x(7,0) - x(5,0) * x(7,1) + x(5,1) * x(7,0) + x(6,0) * x(7,1) - x(6,1) * x(7,0);
373
374 grad(4,0) = x(0,1) * x(1,2) - x(0,1) * x(2,2) + x(0,1) * x(5,2) - x(0,1) * x(6,2) - x(0,2) * x(1,1) + x(0,2) * x(2,1) - x(0,2) * x(5,1) + x(0,2) * x(6,1) + x(1,1) * x(5,2) - x(1,2) * x(5,1) - x(2,1) * x(6,2) + x(2,2) * x(6,1) + x(5,1) * x(6,2) + x(5,1) * x(7,2) - x(5,2) * x(6,1) - x(5,2) * x(7,1) - x(6,1) * x(7,2) + x(6,2) * x(7,1);
375 grad(4,1) = -x(0,0) * x(1,2) + x(0,0) * x(2,2) - x(0,0) * x(5,2) + x(0,0) * x(6,2) + x(0,2) * x(1,0) - x(0,2) * x(2,0) + x(0,2) * x(5,0) - x(0,2) * x(6,0) - x(1,0) * x(5,2) + x(1,2) * x(5,0) + x(2,0) * x(6,2) - x(2,2) * x(6,0) - x(5,0) * x(6,2) - x(5,0) * x(7,2) + x(5,2) * x(6,0) + x(5,2) * x(7,0) + x(6,0) * x(7,2) - x(6,2) * x(7,0);
376 grad(4,2) = x(0,0) * x(1,1) - x(0,0) * x(2,1) + x(0,0) * x(5,1) - x(0,0) * x(6,1) - x(0,1) * x(1,0) + x(0,1) * x(2,0) - x(0,1) * x(5,0) + x(0,1) * x(6,0) + x(1,0) * x(5,1) - x(1,1) * x(5,0) - x(2,0) * x(6,1) + x(2,1) * x(6,0) + x(5,0) * x(6,1) + x(5,0) * x(7,1) - x(5,1) * x(6,0) - x(5,1) * x(7,0) - x(6,0) * x(7,1) + x(6,1) * x(7,0);
377
378 grad(5,0) = x(0,1) * x(1,2) - x(0,1) * x(4,2) - x(0,2) * x(1,1) + x(0,2) * x(4,1) + x(1,1) * x(3,2) - x(1,1) * x(4,2) + x(1,1) * x(7,2) - x(1,2) * x(3,1) + x(1,2) * x(4,1) - x(1,2) * x(7,1) + x(3,1) * x(7,2) - x(3,2) * x(7,1) - x(4,1) * x(6,2) - x(4,1) * x(7,2) + x(4,2) * x(6,1) + x(4,2) * x(7,1) - x(6,1) * x(7,2) + x(6,2) * x(7,1);
379 grad(5,1) = -x(0,0) * x(1,2) + x(0,0) * x(4,2) + x(0,2) * x(1,0) - x(0,2) * x(4,0) - x(1,0) * x(3,2) + x(1,0) * x(4,2) - x(1,0) * x(7,2) + x(1,2) * x(3,0) - x(1,2) * x(4,0) + x(1,2) * x(7,0) - x(3,0) * x(7,2) + x(3,2) * x(7,0) + x(4,0) * x(6,2) + x(4,0) * x(7,2) - x(4,2) * x(6,0) - x(4,2) * x(7,0) + x(6,0) * x(7,2) - x(6,2) * x(7,0);
380 grad(5,2) = x(0,0) * x(1,1) - x(0,0) * x(4,1) - x(0,1) * x(1,0) + x(0,1) * x(4,0) + x(1,0) * x(3,1) - x(1,0) * x(4,1) + x(1,0) * x(7,1) - x(1,1) * x(3,0) + x(1,1) * x(4,0) - x(1,1) * x(7,0) + x(3,0) * x(7,1) - x(3,1) * x(7,0) - x(4,0) * x(6,1) - x(4,0) * x(7,1) + x(4,1) * x(6,0) + x(4,1) * x(7,0) - x(6,0) * x(7,1) + x(6,1) * x(7,0);
381
382 grad(6,0) = -x(0,1) * x(2,2) + x(0,1) * x(4,2) + x(0,2) * x(2,1) - x(0,2) * x(4,1) - x(2,1) * x(3,2) + x(2,1) * x(4,2) - x(2,1) * x(7,2) + x(2,2) * x(3,1) - x(2,2) * x(4,1) + x(2,2) * x(7,1) - x(3,1) * x(7,2) + x(3,2) * x(7,1) + x(4,1) * x(5,2) + x(4,1) * x(7,2) - x(4,2) * x(5,1) - x(4,2) * x(7,1) + x(5,1) * x(7,2) - x(5,2) * x(7,1);
383 grad(6,1) = x(0,0) * x(2,2) - x(0,0) * x(4,2) - x(0,2) * x(2,0) + x(0,2) * x(4,0) + x(2,0) * x(3,2) - x(2,0) * x(4,2) + x(2,0) * x(7,2) - x(2,2) * x(3,0) + x(2,2) * x(4,0) - x(2,2) * x(7,0) + x(3,0) * x(7,2) - x(3,2) * x(7,0) - x(4,0) * x(5,2) - x(4,0) * x(7,2) + x(4,2) * x(5,0) + x(4,2) * x(7,0) - x(5,0) * x(7,2) + x(5,2) * x(7,0);
384 grad(6,2) = -x(0,0) * x(2,1) + x(0,0) * x(4,1) + x(0,1) * x(2,0) - x(0,1) * x(4,0) - x(2,0) * x(3,1) + x(2,0) * x(4,1) - x(2,0) * x(7,1) + x(2,1) * x(3,0) - x(2,1) * x(4,0) + x(2,1) * x(7,0) - x(3,0) * x(7,1) + x(3,1) * x(7,0) + x(4,0) * x(5,1) + x(4,0) * x(7,1) - x(4,1) * x(5,0) - x(4,1) * x(7,0) + x(5,0) * x(7,1) - x(5,1) * x(7,0);
385
386 grad(7,0) = x(1,1) * x(3,2) - x(1,1) * x(5,2) - x(1,2) * x(3,1) + x(1,2) * x(5,1) - x(2,1) * x(3,2) + x(2,1) * x(6,2) + x(2,2) * x(3,1) - x(2,2) * x(6,1) - x(3,1) * x(5,2) + x(3,1) * x(6,2) + x(3,2) * x(5,1) - x(3,2) * x(6,1) + x(4,1) * x(5,2) - x(4,1) * x(6,2) - x(4,2) * x(5,1) + x(4,2) * x(6,1) - x(5,1) * x(6,2) + x(5,2) * x(6,1);
387 grad(7,1) = -x(1,0) * x(3,2) + x(1,0) * x(5,2) + x(1,2) * x(3,0) - x(1,2) * x(5,0) + x(2,0) * x(3,2) - x(2,0) * x(6,2) - x(2,2) * x(3,0) + x(2,2) * x(6,0) + x(3,0) * x(5,2) - x(3,0) * x(6,2) - x(3,2) * x(5,0) + x(3,2) * x(6,0) - x(4,0) * x(5,2) + x(4,0) * x(6,2) + x(4,2) * x(5,0) - x(4,2) * x(6,0) + x(5,0) * x(6,2) - x(5,2) * x(6,0);
388 grad(7,2) = x(1,0) * x(3,1) - x(1,0) * x(5,1) - x(1,1) * x(3,0) + x(1,1) * x(5,0) - x(2,0) * x(3,1) + x(2,0) * x(6,1) + x(2,1) * x(3,0) - x(2,1) * x(6,0) - x(3,0) * x(5,1) + x(3,0) * x(6,1) + x(3,1) * x(5,0) - x(3,1) * x(6,0) + x(4,0) * x(5,1) - x(4,0) * x(6,1) - x(4,1) * x(5,0) + x(4,1) * x(6,0) - x(5,0) * x(6,1) + x(5,1) * x(6,0);
389
390 // Important: Scale the matrix with the missing factor 1/96
391
392 grad *= (DataType(1)/DataType(96));
393
394 }
395
396 public:
400 static void compute_h(ScalarVectorType& h_, const ScalarVectorType& lambda_, const DataType& sum_det_)
401 {
402 DataType_ exponent = DataType_(1)/DataType_(MeshType::world_dim);
403
404 Memory::TypedView<DataType> vh = h_.elements_view_w();
405 const Memory::TypedView<DataType> vl = lambda_.elements_view_r();
406 for(Index cell(0); cell < h_.size(); ++cell)
407 {
408 // For hypercubes, h is half the refence cell's edge length
409 vh[cell] = DataType(0.5)*Math::pow(vl(cell)*sum_det_,exponent);
410 }
411 }
412
416 static DataType_ compute_sum_det(const VectorType& coords_, const MeshType& mesh_)
417 {
418 // This will hold the coordinates for one element for passing to other routines
419 Tiny::Matrix <DataType_, Shape::FaceTraits<ShapeType,0>::count, MeshType::world_dim> x;
420
421 // Index set for local/global numbering
422 const auto& idx = mesh_.template get_index_set<ShapeType::dimension,0>();
423
424 DataType sum_det(0);
425 const auto vc = coords_.elements_view_r();
426 for(Index cell(0); cell < mesh_.get_num_entities(ShapeType::dimension); ++cell)
427 {
428 // Get local coordinates
429 for(int j(0); j < Shape::FaceTraits<ShapeType,0>::count; ++j)
430 {
431 x[j] = vc(idx(cell,j));
432 }
433
434 sum_det += compute_det(x);
435 }
436
437 return sum_det;
438 }
439
443 static void compute_grad_sum_det(VectorType& grad_, const VectorType& coords_, const MeshType& mesh_)
444 {
445 // This will hold the coordinates for one element for passing to other routines
446 Tx x(DataType_(0));
447
448 // Index set for local/global numbering
449 const auto& idx = mesh_.template get_index_set<ShapeType::dimension,0>();
450
451 Tx local_grad(DataType_(0));
452
453 grad_.format();
454 auto vg = grad_.elements_view_rw();
455 const auto vc = coords_.elements_view_r();
456
457 for(Index cell(0); cell < mesh_.get_num_entities(ShapeType::dimension); ++cell)
458 {
459 // Get local coordinates
460 for(int j(0); j < Shape::FaceTraits<ShapeType,0>::count; ++j)
461 {
462 x[j] = vc(idx(cell,j));
463 }
464
465 compute_grad_det(local_grad, x);
466
467 for(int j(0); j < Shape::FaceTraits<ShapeType,0>::count; ++j)
468 {
469 vg[idx(cell, j)] += local_grad[j];
470 }
471
472 }
473 } // compute_grad_sum_det
474
478 static MatTensorType compute_mat_tensor(const Tx& DOXY(x), const DataType_& h)
479 {
480 MatTensorType mat_tensor(DataType_(0));
481 DataType scal(DataType(1)/h);
482
483 for(int d(0); d < MeshType::world_dim; ++d)
484 {
485 mat_tensor(d,d) = scal;
486 }
487
488 return mat_tensor;
489 }
490
491 }; // RumpfTrafo<Hypercube<3>>
492
502 template<typename DataType_>
503 struct RumpfTrafo<Trafo::Standard::Mapping<Geometry::ConformalMesh<Shape::Simplex<2>,2,DataType_>>,DataType_>
504 {
505 public:
507 typedef Trafo::Standard::Mapping<Geometry::ConformalMesh<Shape::Simplex<2>,2,DataType_>> TrafoType;
509 typedef DataType_ DataType;
511 typedef typename TrafoType::ShapeType ShapeType;
513 typedef typename TrafoType::MeshType MeshType;
515 typedef Tiny::Matrix <DataType_, Shape::FaceTraits<ShapeType,0>::count, MeshType::world_dim> Tx;
517 typedef Tiny::Matrix<DataType_, MeshType::world_dim, MeshType::world_dim> MatTensorType;
519 typedef LAFEM::DenseVector<DataType, Index> ScalarVectorType;
521 typedef LAFEM::DenseVectorBlocked<DataType, Index, MeshType::world_dim> VectorType;
522
523 private:
527 static DataType compute_det(Tx& x)
528 {
529 return DataType(2) / Math::sqrt(DataType(3)) *
530 (x(0,0) * x(1,1) - x(0,0) * x(2,1) - x(1,0) * x(0,1) + x(2,0) * x(0,1) + x(1,0) * x(2,1) - x(2,0) * x(1,1));
531 }
532
536 static inline void compute_grad_det(Tx& grad, const Tx& x)
537 {
538 const DataType fac(DataType(2) / Math::sqrt(DataType(3)));
539
540 grad(0,0) = fac * ( x(1,1) - x(2,1));
541 grad(0,1) = fac * (-x(1,0) + x(2,0));
542 grad(1,0) = fac * (-x(0,1) + x(2,1));
543 grad(1,1) = fac * ( x(0,0) - x(2,0));
544 grad(2,0) = fac * ( x(0,1) - x(1,1));
545 grad(2,1) = fac * (-x(0,0) + x(1,0));
546 }
547
548 public:
552 static void compute_h(ScalarVectorType& h_, const ScalarVectorType& lambda_, const DataType& sum_det_)
553 {
554 DataType_ exponent = DataType_(1)/DataType_(MeshType::world_dim);
555
556 Memory::TypedView<DataType_> vh = h_.elements_view_w();
557 const Memory::TypedView<DataType_> vl = lambda_.elements_view_r();
558
559 for(Index cell(0); cell < h_.size(); ++cell)
560 {
561 vh[cell] = Math::pow(vl(cell)*sum_det_,exponent);
562 }
563 }
564
568 static DataType_ compute_sum_det(const VectorType& coords_, const MeshType& mesh_)
569 {
570 // This will hold the coordinates for one element for passing to other routines
571 Tiny::Matrix <DataType_, Shape::FaceTraits<ShapeType,0>::count, MeshType::world_dim> x;
572
573 // Index set for local/global numbering
574 const auto& idx = mesh_.template get_index_set<ShapeType::dimension,0>();
575
576 DataType sum_det(0);
577 const auto vc = coords_.elements_view_r();
578 for(Index cell(0); cell < mesh_.get_num_entities(ShapeType::dimension); ++cell)
579 {
580 // Get local coordinates
581 for(int j(0); j < Shape::FaceTraits<ShapeType,0>::count; ++j)
582 {
583 x[j] = vc(idx(cell,j));
584 }
585
586 sum_det += compute_det(x);
587 }
588
589 return sum_det;
590 }
591
595 static void compute_grad_sum_det(VectorType& grad_, const VectorType& coords_, const MeshType& mesh_)
596 {
597 // This will hold the coordinates for one element for passing to other routines
598 Tx x(DataType_(0));
599
600 // Index set for local/global numbering
601 const auto& idx = mesh_.template get_index_set<ShapeType::dimension,0>();
602
603 Tx local_grad(DataType_(0));
604
605 grad_.format();
606 auto vg = grad_.elements_view_rw();
607 const auto vc = coords_.elements_view_r();
608
609 for(Index cell(0); cell < mesh_.get_num_entities(ShapeType::dimension); ++cell)
610 {
611 // Get local coordinates
612 for(int j(0); j < Shape::FaceTraits<ShapeType,0>::count; ++j)
613 x[j] = vc(idx(cell,j));
614
615 compute_grad_det(local_grad, x);
616
617 for(int j(0); j < Shape::FaceTraits<ShapeType,0>::count; ++j)
618 {
619 vg[idx(cell, j)] += local_grad[j];
620 }
621 }
622 } // compute_grad_sum_det
623
627 static MatTensorType compute_mat_tensor(const Tx& DOXY(x), const DataType_& h)
628 {
629 MatTensorType mat_tensor(DataType_(0));
630 DataType scal(DataType(1)/h);
631
632 //mat_tensor(0,0) = scal;
633
634 //mat_tensor(1,0) = -scal/Math::sqrt(DataType(3));
635 //mat_tensor(1,1) = scal*DataType_(2)/Math::sqrt(DataType(3));
636
637 mat_tensor(0,0) = scal;
638 mat_tensor(0,1) = -scal/Math::sqrt(DataType(3));
639
640 mat_tensor(1,1) = scal*DataType_(2)/Math::sqrt(DataType(3));
641
642 return mat_tensor;
643 }
644
645 }; // RumpfTrafo<Simplex<2>>
646
656 template<typename DataType_>
657 struct RumpfTrafo<Trafo::Standard::Mapping<Geometry::ConformalMesh<Shape::Simplex<3>,3,DataType_>>,DataType_>
658 {
659 public:
661 typedef Trafo::Standard::Mapping<Geometry::ConformalMesh<Shape::Simplex<3>, 3,DataType_>> TrafoType;
663 typedef DataType_ DataType;
665 typedef typename TrafoType::ShapeType ShapeType;
667 typedef typename TrafoType::MeshType MeshType;
669 typedef Tiny::Matrix <DataType_, Shape::FaceTraits<ShapeType,0>::count, MeshType::world_dim> Tx;
671 typedef Tiny::Matrix<DataType_, MeshType::world_dim, MeshType::world_dim> MatTensorType;
673 typedef LAFEM::DenseVector<DataType, Index> ScalarVectorType;
675 typedef LAFEM::DenseVectorBlocked<DataType, Index, MeshType::world_dim> VectorType;
676
677 private:
681 static DataType compute_det(Tx& x)
682 {
683 return -Math::sqrt(DataType(3)) * Math::sqrt(DataType(6)) * (x(0,0) * x(1,1) * x(2,2) - x(0,0) * x(1,1) * x(3,2) - x(0,0) * x(1,2) * x(2,1) + x(0,0) * x(1,2) * x(3,1) + x(0,0) * x(2,1) * x(3,2) - x(0,0) * x(2,2) * x(3,1) - x(0,1) * x(1,0) * x(2,2) + x(0,1) * x(1,0) * x(3,2) + x(0,1) * x(1,2) * x(2,0) - x(0,1) * x(1,2) * x(3,0) - x(0,1) * x(2,0) * x(3,2) + x(0,1) * x(2,2) * x(3,0) + x(0,2) * x(1,0) * x(2,1) - x(0,2) * x(1,0) * x(3,1) - x(0,2) * x(1,1) * x(2,0) + x(0,2) * x(1,1) * x(3,0) + x(0,2) * x(2,0) * x(3,1) - x(0,2) * x(2,1) * x(3,0) - x(1,0) * x(2,1) * x(3,2) + x(1,0) * x(2,2) * x(3,1) + x(1,1) * x(2,0) * x(3,2) - x(1,1) * x(2,2) * x(3,0) - x(1,2) * x(2,0) * x(3,1) + x(1,2) * x(2,1) * x(3,0)) / DataType(3);
684 }
685
689 static inline void compute_grad_det(Tx& grad, const Tx& x)
690 {
691 grad(0,0) = -Math::sqrt(DataType(3)) * Math::sqrt(DataType(6)) * (x(1,1) * x(2,2) - x(1,1) * x(3,2) - x(2,1) * x(1,2) + x(3,1) * x(1,2) + x(2,1) * x(3,2) - x(3,1) * x(2,2)) / DataType(3);
692 grad(0,1) = -Math::sqrt(DataType(3)) * Math::sqrt(DataType(6)) * (-x(1,0) * x(2,2) + x(1,0) * x(3,2) + x(2,0) * x(1,2) - x(3,0) * x(1,2) - x(2,0) * x(3,2) + x(3,0) * x(2,2)) / DataType(3);
693 grad(0,2) = -Math::sqrt(DataType(3)) * Math::sqrt(DataType(6)) * (x(1,0) * x(2,1) - x(1,0) * x(3,1) - x(2,0) * x(1,1) + x(3,0) * x(1,1) + x(2,0) * x(3,1) - x(3,0) * x(2,1)) / DataType(3);
694
695 grad(1,0) = -Math::sqrt(DataType(3)) * Math::sqrt(DataType(6)) * (-x(0,1) * x(2,2) + x(0,1) * x(3,2) + x(2,1) * x(0,2) - x(3,1) * x(0,2) - x(2,1) * x(3,2) + x(3,1) * x(2,2)) / DataType(3);
696 grad(1,1) = -Math::sqrt(DataType(3)) * Math::sqrt(DataType(6)) * (x(0,0) * x(2,2) - x(0,0) * x(3,2) - x(2,0) * x(0,2) + x(3,0) * x(0,2) + x(2,0) * x(3,2) - x(3,0) * x(2,2)) / DataType(3);
697 grad(1,2) = -Math::sqrt(DataType(3)) * Math::sqrt(DataType(6)) * (-x(0,0) * x(2,1) + x(0,0) * x(3,1) + x(2,0) * x(0,1) - x(3,0) * x(0,1) - x(2,0) * x(3,1) + x(3,0) * x(2,1)) / DataType(3);
698
699 grad(2,0) = -Math::sqrt(DataType(3)) * Math::sqrt(DataType(6)) * (x(0,1) * x(1,2) - x(0,1) * x(3,2) - x(1,1) * x(0,2) + x(3,1) * x(0,2) + x(1,1) * x(3,2) - x(3,1) * x(1,2)) / DataType(3);
700 grad(2,1) = -Math::sqrt(DataType(3)) * Math::sqrt(DataType(6)) * (-x(0,0) * x(1,2) + x(0,0) * x(3,2) + x(1,0) * x(0,2) - x(3,0) * x(0,2) - x(1,0) * x(3,2) + x(3,0) * x(1,2)) / DataType(3);
701 grad(2,2) = -Math::sqrt(DataType(3)) * Math::sqrt(DataType(6)) * (x(0,0) * x(1,1) - x(0,0) * x(3,1) - x(1,0) * x(0,1) + x(3,0) * x(0,1) + x(1,0) * x(3,1) - x(3,0) * x(1,1)) / DataType(3);
702
703 grad(3,0) = -Math::sqrt(DataType(3)) * Math::sqrt(DataType(6)) * (-x(0,1) * x(1,2) + x(0,1) * x(2,2) + x(1,1) * x(0,2) - x(2,1) * x(0,2) - x(1,1) * x(2,2) + x(2,1) * x(1,2)) / DataType(3);
704 grad(3,1) = -Math::sqrt(DataType(3)) * Math::sqrt(DataType(6)) * (x(0,0) * x(1,2) - x(0,0) * x(2,2) - x(1,0) * x(0,2) + x(2,0) * x(0,2) + x(1,0) * x(2,2) - x(2,0) * x(1,2)) / DataType(3);
705 grad(3,2) = -Math::sqrt(DataType(3)) * Math::sqrt(DataType(6)) * (-x(0,0) * x(1,1) + x(0,0) * x(2,1) + x(1,0) * x(0,1) - x(2,0) * x(0,1) - x(1,0) * x(2,1) + x(2,0) * x(1,1)) / DataType(3);
706
707
708 }
709
710 public:
714 static void compute_h(ScalarVectorType& h_, const ScalarVectorType& lambda_, const DataType& sum_det_)
715 {
716 DataType_ exponent = DataType_(1)/DataType_(MeshType::world_dim);
717
718 Memory::TypedView<DataType_> vh = h_.elements_view_w();
719 const Memory::TypedView<DataType_> vl = lambda_.elements_view_r();
720 for(Index cell(0); cell < h_.size(); ++cell)
721 {
722 vh[cell] = Math::pow(vl(cell)*sum_det_,exponent);
723 }
724 }
725
729 static DataType_ compute_sum_det(const VectorType& coords_, const MeshType& mesh_)
730 {
731 // This will hold the coordinates for one element for passing to other routines
732 Tiny::Matrix <DataType_, Shape::FaceTraits<ShapeType,0>::count, MeshType::world_dim> x;
733
734 // Index set for local/global numbering
735 const auto& idx = mesh_.template get_index_set<ShapeType::dimension,0>();
736
737 DataType sum_det(0);
738 const auto vc = coords_.elements_view_r();
739 for(Index cell(0); cell < mesh_.get_num_entities(ShapeType::dimension); ++cell)
740 {
741 // Get local coordinates
742 for(int j(0); j < Shape::FaceTraits<ShapeType,0>::count; ++j)
743 {
744 x[j] = vc(idx(cell,j));
745 }
746
747 sum_det += compute_det(x);
748 }
749
750 return sum_det;
751 }
752
756 static void compute_grad_sum_det(VectorType& grad_, const VectorType& coords_, const MeshType& mesh_)
757 {
758 // This will hold the coordinates for one element for passing to other routines
759 Tx x(DataType_(0));
760
761 // Index set for local/global numbering
762 const auto& idx = mesh_.template get_index_set<ShapeType::dimension,0>();
763
764 Tx local_grad(DataType_(0));
765
766 grad_.format();
767
768 auto vg = grad_.elements_view_rw();
769 const auto vc = coords_.elements_view_r();
770
771 for(Index cell(0); cell < mesh_.get_num_entities(ShapeType::dimension); ++cell)
772 {
773 // Get local coordinates
774 for(int j(0); j < Shape::FaceTraits<ShapeType,0>::count; ++j)
775 {
776 x[j] = vc(idx(cell,j));
777 }
778
779 compute_grad_det(local_grad, x);
780
781 for(int j(0); j < Shape::FaceTraits<ShapeType,0>::count; ++j)
782 {
783 vg[idx(cell, j)] += local_grad[j];
784 }
785
786 }
787 } // compute_grad_sum_det
788
792 static MatTensorType compute_mat_tensor(const Tx& DOXY(x), const DataType_& h)
793 {
794 MatTensorType mat_tensor(DataType_(0));
795 DataType scal(DataType(1)/h);
796
797 mat_tensor(0,0) = scal;
798 mat_tensor(0,1) = -scal/Math::sqrt(DataType(3));
799 mat_tensor(0,2) = -scal/Math::sqrt(DataType(6));
800
801 mat_tensor(1,1) = scal*DataType_(2)/Math::sqrt(DataType(3));
802 mat_tensor(1,2) = -scal/Math::sqrt(DataType(6));
803
804 mat_tensor(2,2) = scal*DataType(0.5)*Math::sqrt(DataType(6));
805
806 return mat_tensor;
807 }
808
809
810 }; // RumpfTrafo<Simplex<3>>
811#ifdef FEAT_EICKT
812 extern template struct RumpfTrafo<
813 Trafo::Standard::Mapping<Geometry::ConformalMesh<Shape::Hypercube<2>, 2, double>>, double >;
814 extern template struct RumpfTrafo<
815 Trafo::Standard::Mapping<Geometry::ConformalMesh<Shape::Hypercube<3>, 3, double>>, double >;
816 extern template struct RumpfTrafo<
817 Trafo::Standard::Mapping<Geometry::ConformalMesh<Shape::Simplex<2>, 2, double>>, double >;
818 extern template struct RumpfTrafo<
819 Trafo::Standard::Mapping<Geometry::ConformalMesh<Shape::Simplex<3>, 3, double>>, double >;
820#endif // FEAT_EICKT
821
823 } // namespace Meshopt
824} // namespace FEAT
FEAT Kernel base header.
Blocked Dense data vector class template.
Dense data vector class template.
Tiny Matrix class template.
Standard transformation mapping class template.
Definition: mapping.hpp:39
T_ sqrt(T_ x)
Returns the square-root of a value.
Definition: math.hpp:300
T_ pow(T_ x, T_ y)
Returns x raised to the power of y.
Definition: math.hpp:643
FEAT namespace.
Definition: adjactor.hpp:12
@ grad
specifies whether the space should supply basis function gradients
std::uint64_t Index
Index data type.
Computes quantities associated with the transformation to Rumpf reference cells.
Definition: rumpf_trafo.hpp:44
static void compute_grad_sum_det(VectorType &grad_, const VectorType &coords_, const MeshType &mesh_)
Computes the gradient of sum of all cell's local transformation determinants.
TrafoType::MeshType MeshType
Type of the transformation's underlying mesh.
Definition: rumpf_trafo.hpp:52
static void compute_h(ScalarVectorType &h_, const ScalarVectorType &lambda_, const DataType &sum_det_)
Computes the optimal local mesh size.
TrafoType::ShapeType ShapeType
Our shape type, as the Rumpf smoother needs to know what we are working with.
Definition: rumpf_trafo.hpp:50
static DataType_ compute_sum_det(const VectorType &coords_, const MeshType &mesh_)
Computes the sum of the local transformation's determinants.
Tiny::Matrix< DataType_, Shape::FaceTraits< ShapeType, 0 >::count, MeshType::world_dim > Tx
Type for a pack of local vertex coordinates.
Definition: rumpf_trafo.hpp:54
DataType_ DataType
Our data type.
Definition: rumpf_trafo.hpp:46
static MatTensorType compute_mat_tensor(const Tx &x, const DataType_ &h)
Computes the local matrix describing the material behavior.
static DataType compute_det(Tx &x)
Compute the transformation's determinant on a cell.
Tiny::Matrix< DataType_, MeshType::world_dim, MeshType::world_dim > MatTensorType
Type for the material tensor.
Definition: rumpf_trafo.hpp:56
TrafoType_ TrafoType
Our transformation type.
Definition: rumpf_trafo.hpp:48
static void compute_grad_det(Tx &grad, const Tx &x)
Computes the transformation's determinant's gradient on a cell.
LAFEM::DenseVectorBlocked< DataType, Index, MeshType::world_dim > VectorType
Vector type for coordinate vectors etc.
Definition: rumpf_trafo.hpp:60
LAFEM::DenseVector< DataType, Index > ScalarVectorType
Vector type for element sizes etc.
Definition: rumpf_trafo.hpp:58