Flow123d  DF_patch_fe_mechanics-5faa023
op_function.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file op_function.hh
15  * @brief Store finite element reinit functions.
16  * @author David Flanderka
17  */
18 
19 #ifndef OP_FUNCTION_HH_
20 #define OP_FUNCTION_HH_
21 
22 #include "fem/patch_op.hh"
23 #include "fem/patch_fe_values.hh"
24 
25 
26 
27 namespace Op {
28 
29 /// Class used as template type for type resolution Bulk / Side
30 class BulkDomain {
31 public:
32  static ElemDomain domain() {
34  }
35 
36  static inline constexpr uint n_nodes(uint dim) {
37  return dim+1;
38  }
39 };
40 
41 /// Class used as template type for type resolution Bulk / Side
42 class SideDomain {
43 public:
44  static ElemDomain domain() {
46  }
47 
48  static inline constexpr uint n_nodes(uint dim) {
49  return dim;
50  }
51 };
52 
53 
54 /**
55  * Evaluates node coordinates on Bulk (Element) / Side
56  *
57  * Template parameters:
58  * dim Dimension of operation
59  * ElDomain Target domain - data are evaluated on Bulk / Side domain
60  * Domain Source domain - operation is called from Bulk / Side domain
61  * spacedim Dimension of the solved task
62  */
63 template<unsigned int dim, class ElDomain, class Domain, unsigned int spacedim = 3>
64 class Coords : public PatchOp<spacedim> {
65 public:
66  /// Constructor
68  : PatchOp<spacedim>(dim, pfev, {spacedim, ElDomain::n_nodes(dim)}, OpSizeType::elemOp) {
69  this->domain_ = Domain::domain();
70  }
71 
72  void eval() override {
74  this->allocate_result( ppv.n_elems_, *ppv.patch_fe_data_.patch_arena_ );
75  auto result = this->result_matrix();
76 
77  for (uint i_elm=0; i_elm<ppv.elem_list_.size(); ++i_elm)
78  for (uint i_col=0; i_col<ElDomain::n_nodes(dim); ++i_col)
79  for (uint i_row=0; i_row<spacedim; ++i_row) {
80  result(i_row, i_col)(i_elm) = ( *ppv.template node<ElDomain>(i_elm, i_col) )(i_row);
81  }
82  }
83 
84 };
85 
86 /// Evaluates Jacobians on Bulk (Element) / Side
87 template<unsigned int dim, class ElDomain, class Domain, unsigned int spacedim = 3>
88 class Jac : public PatchOp<spacedim> {
89 public:
90  /// Constructor
92  : PatchOp<spacedim>(dim, pfev, {spacedim, ElDomain::n_nodes(dim)-1}, OpSizeType::elemOp)
93  {
94  this->domain_ = Domain::domain();
95  this->input_ops_.push_back( pfev.template get< Op::Coords<dim, ElDomain, Domain, spacedim>, dim >() );
96  }
97 
98  void eval() override {
99  auto jac_value = this->result_matrix();
100  auto coords_value = this->input_ops(0)->result_matrix();
101  for (unsigned int i=0; i<spacedim; i++)
102  for (unsigned int j=0; j<ElDomain::n_nodes(dim)-1; j++)
103  jac_value(i,j) = coords_value(i,j+1) - coords_value(i,0);
104  }
105 };
106 
107 /// Evaluates Jacobian determinants on Bulk (Element) / Side
108 template<unsigned int dim, class ElDomain, class Domain, unsigned int spacedim = 3>
109 class JacDet : public PatchOp<spacedim> {
110 public:
111  /// Constructor
113  : PatchOp<spacedim>(dim, pfev, {1}, OpSizeType::elemOp)
114  {
115  this->domain_ = Domain::domain();
116  this->input_ops_.push_back( pfev.template get< Op::Jac<dim, ElDomain, Domain, spacedim>, dim >() );
117  }
118 
119  void eval() override {
120  auto jac_det_value = this->result_matrix();
121  auto jac_value = this->input_ops(0)->result_matrix();
122  jac_det_value(0) = eigen_arena_tools::determinant<spacedim, ElDomain::n_nodes(dim)-1>(jac_value).abs();
123  }
124 };
125 
126 /// Template specialization of previous: dim=1, domain=Side
127 template<>
128 class JacDet<1, Op::SideDomain, Op::SideDomain, 3> : public PatchOp<3> {
129 public:
130  /// Constructor
132  : PatchOp<3>(1, pfev, {1}, OpSizeType::elemOp)
133  {
135  }
136 
137  void eval() override {
138  PatchPointValues<3> &ppv = this->ppv();
139  this->allocate_result( ppv.n_elems_, *ppv.patch_fe_data_.patch_arena_ );
140  auto jac_det_value = this->result_matrix();
141  for (uint i=0;i<ppv.n_elems_; ++i) {
142  jac_det_value(0,0)(i) = 1.0;
143  }
144  }
145 };
146 
147 /**
148  * Evaluates Inverse Jacobians on Bulk (Element) / Side
149  * ElDomain (target) is always Bulk
150  */
151 template<unsigned int dim, class Domain, unsigned int spacedim = 3>
152 class InvJac : public PatchOp<spacedim> {
153 public:
154  /// Constructor
156  : PatchOp<spacedim>(dim, pfev, {dim, spacedim}, OpSizeType::elemOp)
157  {
158  this->domain_ = Domain::domain();
159  this->input_ops_.push_back( pfev.template get< Op::Jac<dim, BulkDomain, Domain, spacedim>, dim >() );
160  }
161 
162  void eval() override {
163  auto inv_jac_value = this->result_matrix();
164  auto jac_value = this->input_ops(0)->result_matrix();
165  inv_jac_value = eigen_arena_tools::inverse<spacedim, dim>(jac_value);
166  }
167 };
168 
169 /// Evaluates coordinates of quadrature points - not implemented yet
170 template<unsigned int dim, class Domain, unsigned int spacedim = 3>
171 class PtCoords : public PatchOp<spacedim> {
172 public:
173  /// Constructor
175  : PatchOp<spacedim>(dim, pfev, {spacedim}, OpSizeType::pointOp)
176  {
177  this->domain_ = Domain::domain();
178  }
179 
180  void eval() override {}
181 };
182 
183 /**
184  * Fixed operation points weights
185  * ElDomain (target) is equivalent with Domain (source)
186  */
187 template<unsigned int dim, class Domain, unsigned int spacedim = 3>
188 class Weights : public PatchOp<spacedim> {
189 public:
190  /// Constructor
192  : PatchOp<spacedim>(dim, pfev, {1}, OpSizeType::fixedSizeOp)
193  {
194  this->domain_ = Domain::domain();
195  // create result vector of weights operation in assembly arena
196  const std::vector<double> &point_weights_vec = this->ppv().get_quadrature()->get_weights();
197  this->allocate_result(point_weights_vec.size(), pfev.asm_arena());
198  for (uint i=0; i<point_weights_vec.size(); ++i)
199  this->result_(0)(i) = point_weights_vec[i];
200  }
201 
202  void eval() override {}
203 };
204 
205 /**
206  * Evaluates JxW on quadrature points
207  * ElDomain (target) is equivalent with Domain (source)
208  */
209 template<unsigned int dim, class Domain, unsigned int spacedim = 3>
210 class JxW : public PatchOp<spacedim> {
211 public:
212  /// Constructor
214  : PatchOp<spacedim>(dim, pfev, {1}, OpSizeType::pointOp)
215  {
216  this->domain_ = Domain::domain();
217  this->input_ops_.push_back( pfev.template get< Op::Weights<dim, Domain, spacedim>, dim >() );
218  this->input_ops_.push_back( pfev.template get< Op::JacDet<dim, Domain, Domain, spacedim>, dim >() );
219  }
220 
221  void eval() override {
222  auto weights_value = this->input_ops(0)->result_matrix();
223  auto jac_det_value = this->input_ops(1)->result_matrix();
224  ArenaOVec<double> weights_ovec( weights_value(0,0) );
225  ArenaOVec<double> jac_det_ovec( jac_det_value(0,0) );
226  ArenaOVec<double> jxw_ovec = jac_det_ovec * weights_ovec;
227  this->result_(0) = jxw_ovec.get_vec();
228  }
229 };
230 
231 /// Evaluates normal vector on side quadrature points
232 template<unsigned int dim, unsigned int spacedim = 3>
233 class NormalVec : public PatchOp<spacedim> {
234 public:
235  /// Constructor
237  : PatchOp<spacedim>(dim, pfev, {spacedim}, OpSizeType::elemOp)
238  {
240  this->input_ops_.push_back( pfev.template get< Op::InvJac<dim, Op::SideDomain, spacedim>, dim >() );
241  }
242 
243  void eval() override {
245  auto normal_value = this->result_matrix();
246  auto inv_jac_value = this->input_ops(0)->result_matrix();
247  normal_value = inv_jac_value.transpose() * RefElement<dim>::normal_vector_array( ppv.int_table_(3) );
248 
249  ArenaVec<double> norm_vec( ppv.n_elems_, *ppv.patch_fe_data_.patch_arena_ );
250  Eigen::VectorXd A(3);
251  for (uint i=0; i<normal_value(0).data_size(); ++i) {
252  A(0) = normal_value(0)(i);
253  A(1) = normal_value(1)(i);
254  A(2) = normal_value(2)(i);
255  norm_vec(i) = A.norm();
256  }
257 
258  for (uint i=0; i<spacedim; ++i) {
259  normal_value(i) = normal_value(i) / norm_vec;
260  }
261  }
262 };
263 
264 /// Fixed operation of scalar shape reference values
265 template<unsigned int dim, class Domain, unsigned int spacedim = 3>
266 class RefScalar : public PatchOp<spacedim> {
267 public:
268  /// Constructor
270  : PatchOp<spacedim>(dim, pfev, {1}, OpSizeType::fixedSizeOp, fe->n_dofs())
271  {
272  this->domain_ = Domain::domain();
273  Quadrature *quad = pfev.get_bulk_quadrature(dim);
274  uint n_points = quad->size();
275 
276  this->allocate_result(n_points, pfev.asm_arena());
277  auto ref_scalar_value = this->result_matrix();
278  for (unsigned int i_p = 0; i_p < n_points; i_p++)
279  for (unsigned int i_dof = 0; i_dof < this->n_dofs_; i_dof++)
280  ref_scalar_value(i_dof)(i_p) = fe->shape_value(i_dof, quad->point<dim>(i_p));
281  }
282 
283  void eval() override {}
284 };
285 
286 /// Template specialization of previous: Domain=SideDomain
287 template<unsigned int dim, unsigned int spacedim>
288 class RefScalar<dim, Op::SideDomain, spacedim> : public PatchOp<spacedim> {
289 public:
290  /// Constructor
292  : PatchOp<spacedim>(dim, pfev, {dim+1}, OpSizeType::fixedSizeOp, fe->n_dofs())
293  {
295  Quadrature *quad = pfev.get_side_quadrature(dim);
296  uint n_points = quad->size();
297 
298  this->allocate_result(n_points, pfev.asm_arena());
299  auto ref_scalar_value = this->result_matrix();
300  for (unsigned int s=0; s<dim+1; ++s) {
301  Quadrature side_q = quad->make_from_side<dim>(s);
302  for (unsigned int i_p = 0; i_p < n_points; i_p++)
303  for (unsigned int i_dof = 0; i_dof < this->n_dofs_; i_dof++)
304  ref_scalar_value(s, i_dof)(i_p) = fe->shape_value(i_dof, side_q.point<dim>(i_p));
305  }
306  }
307 
308  void eval() override {}
309 };
310 
311 /// Fixed operation of vector shape reference values
312 template<unsigned int dim, class Domain, unsigned int spacedim = 3>
313 class RefVector : public PatchOp<spacedim> {
314 public:
315  /// Constructor
317  : PatchOp<spacedim>(dim, pfev, {spacedim}, OpSizeType::fixedSizeOp, fe->n_dofs())
318  {
319  this->domain_ = Domain::domain();
320  Quadrature *quad = pfev.get_bulk_quadrature(dim);
321  uint n_points = quad->size();
322 
323  this->allocate_result(n_points, pfev.asm_arena());
324  auto ref_vector_value = this->result_matrix();
325 
326  for (uint i_dof=0; i_dof<this->n_dofs_; ++i_dof)
327  for (uint i_p=0; i_p<n_points; ++i_p)
328  for (uint c=0; c<spacedim; ++c)
329  ref_vector_value(c, i_dof)(i_p) = fe->shape_value(i_dof, quad->point<dim>(i_p), c);
330  }
331 
332  void eval() override {}
333 };
334 
335 /// Template specialization of previous: Domain=SideDomain
336 template<unsigned int dim, unsigned int spacedim>
337 class RefVector<dim, Op::SideDomain, spacedim> : public PatchOp<spacedim> {
338 public:
339  /// Constructor
341  : PatchOp<spacedim>(dim, pfev, {dim+1, spacedim}, OpSizeType::fixedSizeOp, fe->n_dofs())
342  {
344  Quadrature *quad = pfev.get_side_quadrature(dim);
345  uint n_points = quad->size();
346 
347  this->allocate_result(n_points, pfev.asm_arena());
348  auto ref_vector_value = this->result_matrix();
349 
350  for (unsigned int s=0; s<dim+1; ++s) {
351  Quadrature side_q = quad->make_from_side<dim>(s);
352  for (unsigned int i_p = 0; i_p < n_points; i_p++)
353  for (unsigned int i_dof = 0; i_dof < this->n_dofs_; i_dof++)
354  for (uint c=0; c<spacedim; ++c)
355  ref_vector_value(s,3*i_dof+c)(i_p) = fe->shape_value(i_dof, side_q.point<dim>(i_p), c);
356  }
357  }
358 
359  void eval() override {}
360 };
361 
362 /// Fixed operation of gradient scalar reference values
363 template<unsigned int dim, class Domain, unsigned int spacedim = 3>
364 class RefGradScalar : public PatchOp<spacedim> {
365 public:
366  /// Constructor
368  : PatchOp<spacedim>(dim, pfev, {dim, 1}, OpSizeType::fixedSizeOp, fe->n_dofs())
369  {
370  this->domain_ = Domain::domain();
371  Quadrature *quad = pfev.get_bulk_quadrature(dim);
372  uint n_points = quad->size();
373 
374  this->allocate_result(n_points, pfev.asm_arena());
375  auto ref_scalar_value = this->result_matrix();
376  for (uint i_row=0; i_row<ref_scalar_value.rows(); ++i_row)
377  for (uint i_dof=0; i_dof<this->n_dofs_; ++i_dof)
378  for (uint i_p=0; i_p<n_points; ++i_p)
379  ref_scalar_value(i_row, i_dof)(i_p) = fe->shape_grad(i_dof, quad->point<dim>(i_p))[i_row];
380  }
381 
382  void eval() override {}
383 };
384 
385 /// Template specialization of previous: Domain=SideDomain
386 template<unsigned int dim, unsigned int spacedim>
387 class RefGradScalar<dim, Op::SideDomain, spacedim> : public PatchOp<spacedim> {
388 public:
389  /// Constructor
391  : PatchOp<spacedim>(dim, pfev, {dim+1, dim}, OpSizeType::fixedSizeOp, fe->n_dofs())
392  {
394  Quadrature *quad = pfev.get_side_quadrature(dim);
395  uint n_points = quad->size();
396 
397  this->allocate_result(n_points, pfev.asm_arena());
398  auto ref_scalar_value = this->result_matrix();
399  for (unsigned int s=0; s<dim+1; ++s) {
400  Quadrature side_q = quad->make_from_side<dim>(s);
401  for (uint i_dof=0; i_dof<this->n_dofs_; ++i_dof)
402  for (uint i_p=0; i_p<n_points; ++i_p)
403  for (uint c=0; c<dim; ++c)
404  ref_scalar_value(s,dim*i_dof+c)(i_p) = fe->shape_grad(i_dof, side_q.point<dim>(i_p))[c];
405  }
406  }
407 
408  void eval() override {}
409 };
410 
411 /// Fixed operation of gradient scalar reference values
412 template<unsigned int dim, class Domain, unsigned int spacedim = 3>
413 class RefGradVector : public PatchOp<spacedim> {
414 public:
415  /// Constructor
417  : PatchOp<spacedim>(dim, pfev, {dim, spacedim}, OpSizeType::fixedSizeOp, fe->n_dofs())
418  {
419  this->domain_ = Domain::domain();
420  Quadrature *quad = pfev.get_bulk_quadrature(dim);
421  uint n_points = quad->size();
422 
423  this->allocate_result(n_points, pfev.asm_arena());
424  auto ref_vector_value = this->result_matrix();
425  for (uint i_c=0; i_c<spacedim; ++i_c) {
426  for (uint i_dim=0; i_dim<dim; ++i_dim)
427  for (uint i_dof=0; i_dof<this->n_dofs_; ++i_dof)
428  for (uint i_p=0; i_p<n_points; ++i_p)
429  ref_vector_value(i_dim,3*i_dof+i_c)(i_p) = fe->shape_grad(i_dof, quad->point<dim>(i_p), i_c)[i_dim];
430  }
431  }
432 
433  void eval() override {}
434 };
435 
436 /// Template specialization of previous: Domain=SideDomain
437 template<unsigned int dim, unsigned int spacedim>
438 class RefGradVector<dim, Op::SideDomain, spacedim> : public PatchOp<spacedim> {
439 public:
440  /// Constructor
442  : PatchOp<spacedim>(dim, pfev, {(dim+1)*dim, spacedim}, OpSizeType::fixedSizeOp, fe->n_dofs())
443  {
445  Quadrature *quad = pfev.get_side_quadrature(dim);
446  uint n_points = quad->size();
447  uint n_sides = dim+1;
448 
449  this->allocate_result(n_points, pfev.asm_arena());
450  auto ref_vector_value = this->result_matrix();
451  for (uint i_sd=0; i_sd<n_sides; ++i_sd) {
452  Quadrature side_q = quad->make_from_side<dim>(i_sd);
453  for (uint i_c=0; i_c<spacedim; ++i_c)
454  for (uint i_dim=0; i_dim<dim; ++i_dim)
455  for (uint i_dof=0; i_dof<this->n_dofs_; ++i_dof)
456  for (uint i_p=0; i_p<n_points; ++i_p)
457  ref_vector_value(i_sd*dim+i_dim, 3*i_dof+i_c)(i_p) = fe->shape_grad(i_dof, side_q.point<dim>(i_p), i_c)[i_dim];
458  }
459  }
460 
461  void eval() override {}
462 };
463 
464 /// Evaluates scalar shape values
465 template<unsigned int dim, class Domain, unsigned int spacedim = 3>
466 class ScalarShape : public PatchOp<spacedim> {
467 public:
468  /// Constructor
470  : PatchOp<spacedim>(dim, pfev, {1}, OpSizeType::pointOp, fe->n_dofs())
471  {
472  ASSERT_EQ(fe->fe_type(), FEType::FEScalar).error("Type of FiniteElement of scalar_shape must be FEScalar!\n");
473  this->domain_ = Domain::domain();
474  this->input_ops_.push_back( pfev.template get< Op::RefScalar<dim, Domain, spacedim>, dim >(fe) );
475  }
476 
477  void eval() override {
478  auto ref_vec = this->input_ops(0)->result_matrix();
479  auto result_vec = this->result_matrix();
480 
481  uint n_dofs = this->n_dofs();
482  uint n_elem = this->ppv().n_elems_;
483 
484  ArenaVec<double> elem_vec(n_elem, this->patch_fe_->patch_arena());
485  for (uint i=0; i<n_elem; ++i) {
486  elem_vec(i) = 1.0;
487  }
488  ArenaOVec<double> elem_ovec(elem_vec);
489 
490  Eigen::Vector<ArenaOVec<double>, Eigen::Dynamic> ref_ovec(n_dofs);
491  for (uint i=0; i<n_dofs; ++i) {
492  ref_ovec(i) = ArenaOVec<double>( ref_vec(i) );
493  }
494 
495  Eigen::Vector<ArenaOVec<double>, Eigen::Dynamic> result_ovec = elem_ovec * ref_ovec;
496  for (uint i=0; i<n_dofs; ++i) {
497  result_vec(i) = result_ovec(i).get_vec();
498  }
499  }
500 };
501 
502 /// Template specialization of previous: Domain=SideDomain
503 template<unsigned int dim, unsigned int spacedim>
504 class ScalarShape<dim, Op::SideDomain, spacedim> : public PatchOp<spacedim> {
505 public:
506  /// Constructor
508  : PatchOp<spacedim>(dim, pfev, {1}, OpSizeType::pointOp, fe->n_dofs())
509  {
510  ASSERT_EQ(fe->fe_type(), FEType::FEScalar).error("Type of FiniteElement of scalar_shape must be FEScalar!\n");
512  this->input_ops_.push_back( pfev.template get< Op::RefScalar<dim, Op::SideDomain, spacedim>, dim >(fe) );
513  }
514 
515  void eval() override {
518 
519  auto ref_vec = this->input_ops(0)->result_matrix();
520  auto result_vec = this->result_matrix();
521 
522  uint n_dofs = this->n_dofs();
523  uint n_sides = ppv.n_elems_; // number of sides on patch
524  uint n_patch_points = ppv.n_points_; // number of points on patch
525 
526  for (uint i_dof=0; i_dof<n_dofs; ++i_dof) {
527  for (uint i_pt=0; i_pt<n_patch_points; ++i_pt) {
528  result_vec(i_dof)(i_pt) = ref_vec(ppv.int_table_(4)(i_pt), i_dof)(i_pt / n_sides);
529  }
530  }
531  }
532 };
533 
534 /// Evaluates vector values (FEType == FEVector)
535 template<unsigned int dim, class Domain, unsigned int spacedim = 3>
536 class VectorShape : public PatchOp<spacedim> {
537 public:
538  /// Constructor
540  : PatchOp<spacedim>(dim, pfev, {spacedim}, OpSizeType::pointOp, fe->n_dofs()), dispatch_op_(dispatch_op)
541  {
542  this->domain_ = Domain::domain();
543  this->input_ops_.push_back( pfev.template get< Op::RefVector<dim, Domain, spacedim>, dim >(fe) );
544  }
545 
546  void eval() override {
547  auto ref_shape_vec = this->input_ops(0)->result_matrix();
548  auto result_vec = dispatch_op_.result_matrix();
549 
550  uint n_dofs = this->n_dofs();
551  uint n_elem = this->ppv().n_elems_;
552 
553  ArenaVec<double> elem_vec(n_elem, this->patch_fe_->patch_arena());
554  for (uint i=0; i<n_elem; ++i) {
555  elem_vec(i) = 1.0;
556  }
557  ArenaOVec<double> elem_ovec(elem_vec);
558 
559  Eigen::Matrix<ArenaOVec<double>, Eigen::Dynamic, Eigen::Dynamic> ref_shape_ovec(3, n_dofs);
560  for (uint c=0; c<spacedim*n_dofs; ++c) {
561  ref_shape_ovec(c) = ArenaOVec(ref_shape_vec(c));
562  }
563 
564  Eigen::Matrix<ArenaOVec<double>, Eigen::Dynamic, Eigen::Dynamic> result_ovec = elem_ovec * ref_shape_ovec;
565  for (uint c=0; c<spacedim*n_dofs; ++c)
566  result_vec(c) = result_ovec(c).get_vec();
567  }
568 
569 private:
571 };
572 
573 /// Template specialization of previous: Domain=SideDomain)
574 template<unsigned int dim, unsigned int spacedim>
575 class VectorShape<dim, Op::SideDomain, spacedim> : public PatchOp<spacedim> {
576 public:
577  /// Constructor
579  : PatchOp<spacedim>(dim, pfev, {spacedim}, OpSizeType::pointOp, fe->n_dofs()), dispatch_op_(dispatch_op)
580  {
582  this->input_ops_.push_back( pfev.template get< Op::RefVector<dim, Op::SideDomain, spacedim>, dim >(fe) );
583  }
584 
585  void eval() override {
588 
589  auto ref_shape_vec = this->input_ops(0)->result_matrix(); // dim+1 x spacedim
590  auto result_vec = dispatch_op_.result_matrix(); // spacdim x 1
591 
592  uint n_dofs = this->n_dofs();
593  uint n_sides = ppv.n_elems_;
594  uint n_patch_points = ppv.n_points_;
595 
596  for (uint c=0; c<spacedim*n_dofs; c++)
597  result_vec(c) = ArenaVec<double>(n_patch_points, ppv.patch_arena());
598 
599  for (uint i_dof=0; i_dof<n_dofs; ++i_dof) {
600  for (uint i_pt=0; i_pt<n_patch_points; ++i_pt)
601  for (uint c=0; c<spacedim; c++)
602  result_vec(c,i_dof)(i_pt) = ref_shape_vec(ppv.int_table_(4)(i_pt),3*i_dof+c)(i_pt / n_sides);
603  }
604  }
605 
606 private:
608 };
609 
610 // class OpVectorCovariantShape
611 // class OpVectorPiolaShape
612 
613 /// Dispatch class of vector values
614 template<unsigned int dim, class Domain, unsigned int spacedim = 3>
615 class DispatchVectorShape : public PatchOp<spacedim> {
616 public:
617  /// Constructor
619  : PatchOp<spacedim>(dim, pfev, {spacedim}, OpSizeType::pointOp, fe->n_dofs()), in_op_(nullptr)
620  {
621  this->domain_ = Domain::domain();
622  switch (fe->fe_type()) {
623  case FEVector:
624  {
625  in_op_ = new VectorShape<dim, Domain, spacedim>(pfev, fe, *this);
626  break;
627  }
629  {
630  ASSERT_PERMANENT(false).error("Shape vector for FEVectorContravariant is not implemented yet!\n"); // temporary assert
631  //in_op_ = new OpVectorCovariantShape<dim, Domain, spacedim>(pfev, fe, *this);
632  break;
633  }
634  case FEVectorPiola:
635  {
636  ASSERT_PERMANENT(false).error("Shape vector for FEVectorPiola is not implemented yet!\n"); // temporary assert
637  //in_op_ = new OpVectorPiolaShape<dim, Domain, spacedim>(pfev, fe, *this);
638  break;
639  }
640  default:
641  ASSERT(false).error("Type of FiniteElement of grad_vector_shape accessor must be FEVector, FEVectorPiola or FEVectorContravariant!\n");
642  }
643 
644  }
645 
646  void eval() override {
647  in_op_->eval();
648  }
649 
650 private:
652 };
653 
654 /// Evaluates gradient scalar values
655 template<unsigned int dim, class Domain, unsigned int spacedim = 3>
656 class GradScalarShape : public PatchOp<spacedim> {
657 public:
658  /// Constructor
660  : PatchOp<spacedim>(dim, pfev, {spacedim, 1}, OpSizeType::pointOp, fe->n_dofs())
661  {
662  ASSERT_EQ(fe->fe_type(), FEType::FEScalar).error("Type of FiniteElement of grad_scalar_shape must be FEScalar!\n");
663  this->domain_ = Domain::domain();
664  this->input_ops_.push_back( pfev.template get< Op::InvJac<dim, Domain, spacedim>, dim >() );
665  this->input_ops_.push_back( pfev.template get< Op::RefGradScalar<dim, Domain, spacedim>, dim >(fe) );
666  }
667 
668  void eval() override {
669  auto inv_jac_vec = this->input_ops(0)->result_matrix(); // dim x spacedim=3
670  auto ref_grads_vec = this->input_ops(1)->result_matrix(); // dim x n_dofs
671 
672  uint n_dofs = this->n_dofs();
673 
674  Eigen::Matrix<ArenaOVec<double>, Eigen::Dynamic, Eigen::Dynamic> ref_grads_ovec(this->dim_, n_dofs);
675  for (uint i=0; i<this->dim_*n_dofs; ++i) {
676  ref_grads_ovec(i) = ArenaOVec(ref_grads_vec(i));
677  }
678 
679  Eigen::Matrix<ArenaOVec<double>, dim, 3> inv_jac_ovec;
680  for (uint i=0; i<this->dim_*spacedim; ++i) {
681  inv_jac_ovec(i) = ArenaOVec(inv_jac_vec(i));
682  }
683 
684  auto result_vec = this->result_matrix();
685  Eigen::Matrix<ArenaOVec<double>, Eigen::Dynamic, Eigen::Dynamic> result_ovec = inv_jac_ovec.transpose() * ref_grads_ovec;
686  for (uint i=0; i<spacedim*n_dofs; ++i) {
687  result_vec(i) = result_ovec(i).get_vec();
688  }
689  }
690 };
691 
692 /// Template specialization of previous: Domain=SideDomain
693 template<unsigned int dim, unsigned int spacedim>
694 class GradScalarShape<dim, Op::SideDomain, spacedim> : public PatchOp<spacedim> {
695 public:
696  /// Constructor
698  : PatchOp<spacedim>(dim, pfev, {spacedim, 1}, OpSizeType::pointOp, fe->n_dofs())
699  {
700  ASSERT_EQ(fe->fe_type(), FEType::FEScalar).error("Type of FiniteElement of grad_scalar_shape must be FEScalar!\n");
702  this->input_ops_.push_back( pfev.template get< Op::InvJac<dim, Op::SideDomain, spacedim>, dim >() );
703  this->input_ops_.push_back( pfev.template get< Op::RefGradScalar<dim, Op::SideDomain, spacedim>, dim >(fe) );
704  }
705 
706  void eval() override {
709 
710  auto ref_shape_grads = this->input_ops(1)->result_matrix();
711  auto grad_scalar_shape_value = this->result_matrix();
712 
713  uint n_dofs = this->n_dofs();
714  uint n_points = ref_shape_grads(0).data_size();
715  uint n_sides = ppv.n_elems_;
716  uint n_patch_points = ppv.n_points_;
717 
718  // Expands inverse jacobian to inv_jac_expd_value
719  auto inv_jac_value = this->input_ops(0)->result_matrix();
720  Eigen::Matrix<ArenaVec<double>, dim, 3> inv_jac_expd_value;
721  for (uint i=0; i<dim*3; ++i) {
722  inv_jac_expd_value(i) = ArenaVec<double>( n_patch_points, ppv.patch_arena() );
723  for (uint j=0; j<n_patch_points; ++j)
724  inv_jac_expd_value(i)(j) = inv_jac_value(i)(j%n_sides);
725  }
726 
727  // Fill ref shape gradients by q_point. DOF and side_idx
728  Eigen::Matrix<ArenaVec<double>, Eigen::Dynamic, Eigen::Dynamic> ref_shape_grads_expd(dim, n_dofs);
729  for (uint i=0; i<dim*n_dofs; ++i) {
730  ref_shape_grads_expd(i) = ArenaVec<double>( n_patch_points, ppv.patch_arena() );
731  }
732  for (uint i_dof=0; i_dof<n_dofs; ++i_dof) {
733  for (uint i_pt=0; i_pt<n_points; ++i_pt) {
734  uint i_begin = i_pt * n_sides;
735  for (uint i_sd=0; i_sd<n_sides; ++i_sd) {
736  for (uint i_c=0; i_c<dim; ++i_c) {
737  ref_shape_grads_expd(i_c, i_dof)(i_begin + i_sd) = ref_shape_grads(ppv.int_table_(3)(i_sd), i_dof*dim+i_c)(i_pt);
738  }
739  }
740  }
741  }
742 
743  // computes operation result
744  grad_scalar_shape_value = inv_jac_expd_value.transpose() * ref_shape_grads_expd;
745  }
746 };
747 
748 /// Evaluates vector values (FEType == FEVector)
749 template<unsigned int dim, class Domain, unsigned int spacedim = 3>
750 class GradVectorShape : public PatchOp<spacedim> {
751 public:
752  /// Constructor
754  : PatchOp<spacedim>(dim, pfev, {spacedim, spacedim}, OpSizeType::pointOp, fe->n_dofs()), dispatch_op_(dispatch_op)
755  {
756  this->domain_ = Domain::domain();
757  this->input_ops_.push_back( pfev.template get< Op::InvJac<dim, Domain, spacedim>, dim >() );
758  this->input_ops_.push_back( pfev.template get< Op::RefGradVector<dim, Domain, spacedim>, dim >(fe) );
759  }
760 
761  void eval() override {
762  auto inv_jac_vec = this->input_ops(0)->result_matrix(); // dim x spacedim
763  auto ref_grads_vec = this->input_ops(1)->result_matrix(); // dim x spacedim
764  auto result_vec = dispatch_op_.result_matrix(); // spacedim x spacedim
765 
766  uint n_dofs = this->n_dofs();
767 
768  Eigen::Matrix<ArenaOVec<double>, dim, 3> inv_jac_ovec;
769  for (uint i=0; i<dim*spacedim; ++i) {
770  inv_jac_ovec(i) = ArenaOVec(inv_jac_vec(i));
771  }
772 
773  Eigen::Matrix<ArenaOVec<double>, dim, spacedim> ref_grads_ovec;
774  for (uint i_dof=0; i_dof<n_dofs; ++i_dof) {
775  for (uint i=0; i<spacedim*dim; ++i) {
776  ref_grads_ovec(i) = ArenaOVec(ref_grads_vec(i_dof*3*dim + i));
777  }
778 
779  Eigen::Matrix<ArenaOVec<double>, spacedim, spacedim> result_ovec = inv_jac_ovec.transpose() * ref_grads_ovec;
780  for (uint i=0; i<spacedim; ++i) {
781  for (uint j=0; j<spacedim; ++j) {
782  result_vec(j,i+spacedim*i_dof) = result_ovec(i,j).get_vec();
783  }
784  }
785  }
786  }
787 
788 private:
790 };
791 
792 /// Template specialization of previous: Domain=SideDomain)
793 template<unsigned int dim, unsigned int spacedim>
794 class GradVectorShape<dim, Op::SideDomain, spacedim> : public PatchOp<spacedim> {
795 public:
796  /// Constructor
798  : PatchOp<spacedim>(dim, pfev, {spacedim, spacedim}, OpSizeType::pointOp, fe->n_dofs()), dispatch_op_(dispatch_op)
799  {
801  this->input_ops_.push_back( pfev.template get< Op::InvJac<dim, Op::SideDomain, spacedim>, dim >() );
802  this->input_ops_.push_back( pfev.template get< Op::RefGradVector<dim, Op::SideDomain, spacedim>, dim >(fe) );
803  }
804 
805  void eval() override {
807  auto inv_jac_value = this->input_ops(0)->result_matrix(); // dim x spacedim
808  auto ref_vector_grad = this->input_ops(1)->result_matrix(); // n_sides*dim x spacedim
809 
810  uint n_dofs = this->n_dofs();
811  uint n_points = ref_vector_grad(0).data_size();
812  uint n_patch_sides = ppv.n_elems_;
813  uint n_patch_points = ppv.n_points_;
814 
815  // Expands inverse jacobian to inv_jac_expd_value
816  Eigen::Matrix<ArenaVec<double>, dim, 3> inv_jac_expd_value;
817  for (uint i=0; i<dim*3; ++i) {
818  inv_jac_expd_value(i) = ArenaVec<double>( n_patch_points, ppv.patch_arena() );
819  for (uint j=0; j<n_patch_points; ++j)
820  inv_jac_expd_value(i)(j) = inv_jac_value(i)(j%n_patch_sides);
821  }
822 
823  // Fill ref shape gradients by q_point. DOF and side_idx
824  Eigen::Matrix<ArenaVec<double>, dim, 3> ref_shape_grads_expd;
825  for (uint i=0; i<spacedim*dim; ++i) {
826  ref_shape_grads_expd(i) = ArenaVec<double>( n_patch_points, ppv.patch_arena() );
827  }
828  for (uint i_dof=0; i_dof<n_dofs; ++i_dof) {
829 
830  for (uint i_pt=0; i_pt<n_points; ++i_pt) {
831  uint i_begin = i_pt * n_patch_sides;
832  for (uint i_sd=0; i_sd<n_patch_sides; ++i_sd) {
833  for (uint i_dim=0; i_dim<dim; ++i_dim) {
834  for (uint i_c=0; i_c<spacedim; ++i_c) {
835  ref_shape_grads_expd(i_dim, i_c)(i_begin + i_sd) = ref_vector_grad(ppv.int_table_(3)(i_sd)*dim+i_dim, 3*i_dof+i_c)(i_pt);
836  }
837  }
838  }
839  }
840 
841  // computes operation result
842  Eigen::Map< Eigen::Matrix<ArenaVec<double>, Eigen::Dynamic, Eigen::Dynamic> > res_submat = dispatch_op_.result_sub_matrix(i_dof);
843  res_submat = (inv_jac_expd_value.transpose() * ref_shape_grads_expd).transpose();
844  }
845  }
846 
847 private:
849 };
850 
851 // class OpGradVectorCovariantShape
852 // class OpGradVectorPiolaShape
853 
854 /// Dispatch class of vector values
855 template<unsigned int dim, class Domain, unsigned int spacedim = 3>
856 class DispatchGradVectorShape : public PatchOp<spacedim> {
857 public:
858  /// Constructor
860  : PatchOp<spacedim>(dim, pfev, {spacedim, spacedim}, OpSizeType::pointOp, fe->n_dofs()), in_op_(nullptr)
861  {
862  this->domain_ = Domain::domain();
863  switch (fe->fe_type()) {
864  case FEVector:
865  {
866  in_op_ = new GradVectorShape<dim, Domain, spacedim>(pfev, fe, *this);
867  break;
868  }
870  {
871  ASSERT_PERMANENT(false).error("Shape vector for FEVectorContravariant is not implemented yet!\n"); // temporary assert
872  //in_op_ = new OpGradVectorCovariantShape<dim, Domain, spacedim>(pfev, fe, *this);
873  break;
874  }
875  case FEVectorPiola:
876  {
877  ASSERT_PERMANENT(false).error("Shape vector for FEVectorPiola is not implemented yet!\n"); // temporary assert
878  //in_op_ = new OpGradVectorPiolaShape<dim, Domain, spacedim>(pfev, fe, *this);
879  break;
880  }
881  default:
882  ASSERT(false).error("Type of FiniteElement of grad_vector_shape accessor must be FEVector, FEVectorPiola or FEVectorContravariant!\n");
883  }
884 
885  }
886 
887  void eval() override {
888  in_op_->eval();
889  }
890 
891 private:
893 };
894 
895 /// Evaluates vector symmetric gradients
896 template<unsigned int dim, class Domain, unsigned int spacedim = 3>
897 class VectorSymGrad : public PatchOp<spacedim> {
898 public:
899  /// Constructor
901  : PatchOp<spacedim>(dim, pfev, {spacedim, spacedim}, OpSizeType::pointOp, fe->n_dofs())
902  {
903  this->domain_ = Domain::domain();
904  this->input_ops_.push_back( pfev.template get< DispatchGradVectorShape<dim, Domain, spacedim>, dim >(fe) );
905  }
906 
907  void eval() override {
908  for (uint i_dof=0; i_dof<this->n_dofs(); ++i_dof) {
909  Eigen::Map< Eigen::Matrix<ArenaVec<double>, Eigen::Dynamic, Eigen::Dynamic> > grad_vector_dof = this->input_ops(0)->result_sub_matrix(i_dof);
910  Eigen::Map< Eigen::Matrix<ArenaVec<double>, Eigen::Dynamic, Eigen::Dynamic> > sym_grad_dof = this->result_sub_matrix(i_dof);
911  sym_grad_dof = 0.5 * (grad_vector_dof.transpose() + grad_vector_dof);
912  }
913  }
914 };
915 
916 /// Evaluates vector vector divergence
917 template<unsigned int dim, class Domain, unsigned int spacedim = 3>
918 class VectorDivergence : public PatchOp<spacedim> {
919 public:
920  /// Constructor
922  : PatchOp<spacedim>(dim, pfev, {1}, OpSizeType::pointOp, fe->n_dofs())
923  {
924  this->domain_ = Domain::domain();
925  this->input_ops_.push_back( pfev.template get< DispatchGradVectorShape<dim, Domain, spacedim>, dim >(fe) );
926  }
927 
928  void eval() override {
929  auto divergence_value = this->result_matrix();
930 
931  for (uint i_dof=0; i_dof<this->n_dofs(); ++i_dof) {
932  Eigen::Map< Eigen::Matrix<ArenaVec<double>, Eigen::Dynamic, Eigen::Dynamic> > grad_vector_dof = this->input_ops(0)->result_sub_matrix(i_dof);
933  divergence_value(i_dof) = grad_vector_dof(0,0) + grad_vector_dof(1,1) + grad_vector_dof(2,2);
934  }
935  }
936 };
937 
938 /// Class represents zero operation of Join quantities.
939 template<unsigned int dim, class Domain, unsigned int spacedim = 3>
940 class OpZero : public PatchOp<spacedim> {
941 public:
942  /// Constructor
944  : PatchOp<spacedim>(dim, pfev, {spacedim, spacedim}, OpSizeType::fixedSizeOp, fe->n_dofs())
945  {
946  this->domain_ = Domain::domain();
947  this->allocate_const_result( this->ppv().patch_fe_data_.zero_vec_ );
948  }
949 
950  void eval() override {}
951 };
952 
953 } // end of namespace Op
954 
955 
956 #endif /* OP_FUNCTION_HH_ */
#define ASSERT(expr)
Definition: asserts.hh:351
#define ASSERT_PERMANENT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
Definition: asserts.hh:348
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
Definition: asserts.hh:333
ArenaVec< T > get_vec() const
Convert ArenaOVec to ArenaVec and its.
Definition: arena_vec.hh:329
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
Class used as template type for type resolution Bulk / Side.
Definition: op_function.hh:30
static ElemDomain domain()
Definition: op_function.hh:32
static constexpr uint n_nodes(uint dim)
Definition: op_function.hh:36
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:72
Coords(PatchFEValues< spacedim > &pfev)
Constructor.
Definition: op_function.hh:67
Dispatch class of vector values.
Definition: op_function.hh:856
PatchOp< spacedim > * in_op_
Definition: op_function.hh:892
DispatchGradVectorShape(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe)
Constructor.
Definition: op_function.hh:859
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:887
Dispatch class of vector values.
Definition: op_function.hh:615
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:646
PatchOp< spacedim > * in_op_
Definition: op_function.hh:651
DispatchVectorShape(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe)
Constructor.
Definition: op_function.hh:618
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:706
GradScalarShape(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe)
Constructor.
Definition: op_function.hh:697
Evaluates gradient scalar values.
Definition: op_function.hh:656
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:668
GradScalarShape(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe)
Constructor.
Definition: op_function.hh:659
GradVectorShape(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe, PatchOp< spacedim > &dispatch_op)
Constructor.
Definition: op_function.hh:797
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:805
Evaluates vector values (FEType == FEVector)
Definition: op_function.hh:750
PatchOp< spacedim > & dispatch_op_
Definition: op_function.hh:789
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:761
GradVectorShape(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe, PatchOp< spacedim > &dispatch_op)
Constructor.
Definition: op_function.hh:753
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:162
InvJac(PatchFEValues< spacedim > &pfev)
Constructor.
Definition: op_function.hh:155
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:137
JacDet(PatchFEValues< 3 > &pfev)
Constructor.
Definition: op_function.hh:131
Evaluates Jacobian determinants on Bulk (Element) / Side.
Definition: op_function.hh:109
JacDet(PatchFEValues< spacedim > &pfev)
Constructor.
Definition: op_function.hh:112
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:119
Evaluates Jacobians on Bulk (Element) / Side.
Definition: op_function.hh:88
Jac(PatchFEValues< spacedim > &pfev)
Constructor.
Definition: op_function.hh:91
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:98
JxW(PatchFEValues< spacedim > &pfev)
Constructor.
Definition: op_function.hh:213
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:221
Evaluates normal vector on side quadrature points.
Definition: op_function.hh:233
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:243
NormalVec(PatchFEValues< spacedim > &pfev)
Constructor.
Definition: op_function.hh:236
Class represents zero operation of Join quantities.
Definition: op_function.hh:940
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:950
OpZero(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe)
Constructor.
Definition: op_function.hh:943
Evaluates coordinates of quadrature points - not implemented yet.
Definition: op_function.hh:171
PtCoords(PatchFEValues< spacedim > &pfev)
Constructor.
Definition: op_function.hh:174
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:180
Template specialization of previous: Domain=SideDomain.
Definition: op_function.hh:387
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:408
RefGradScalar(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe)
Constructor.
Definition: op_function.hh:390
Fixed operation of gradient scalar reference values.
Definition: op_function.hh:364
RefGradScalar(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe)
Constructor.
Definition: op_function.hh:367
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:382
Template specialization of previous: Domain=SideDomain.
Definition: op_function.hh:438
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:461
RefGradVector(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe)
Constructor.
Definition: op_function.hh:441
Fixed operation of gradient scalar reference values.
Definition: op_function.hh:413
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:433
RefGradVector(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe)
Constructor.
Definition: op_function.hh:416
Template specialization of previous: Domain=SideDomain.
Definition: op_function.hh:288
RefScalar(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe)
Constructor.
Definition: op_function.hh:291
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:308
Fixed operation of scalar shape reference values.
Definition: op_function.hh:266
RefScalar(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe)
Constructor.
Definition: op_function.hh:269
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:283
Template specialization of previous: Domain=SideDomain.
Definition: op_function.hh:337
RefVector(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe)
Constructor.
Definition: op_function.hh:340
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:359
Fixed operation of vector shape reference values.
Definition: op_function.hh:313
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:332
RefVector(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe)
Constructor.
Definition: op_function.hh:316
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:515
ScalarShape(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe)
Constructor.
Definition: op_function.hh:507
Evaluates scalar shape values.
Definition: op_function.hh:466
ScalarShape(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe)
Constructor.
Definition: op_function.hh:469
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:477
Class used as template type for type resolution Bulk / Side.
Definition: op_function.hh:42
static constexpr uint n_nodes(uint dim)
Definition: op_function.hh:48
static ElemDomain domain()
Definition: op_function.hh:44
Evaluates vector vector divergence.
Definition: op_function.hh:918
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:928
VectorDivergence(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe)
Constructor.
Definition: op_function.hh:921
VectorShape(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe, PatchOp< spacedim > &dispatch_op)
Constructor.
Definition: op_function.hh:578
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:585
Evaluates vector values (FEType == FEVector)
Definition: op_function.hh:536
PatchOp< spacedim > & dispatch_op_
Definition: op_function.hh:570
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:546
VectorShape(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe, PatchOp< spacedim > &dispatch_op)
Constructor.
Definition: op_function.hh:539
Evaluates vector symmetric gradients.
Definition: op_function.hh:897
VectorSymGrad(PatchFEValues< spacedim > &pfev, std::shared_ptr< FiniteElement< dim >> fe)
Constructor.
Definition: op_function.hh:900
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:907
Weights(PatchFEValues< spacedim > &pfev)
Constructor.
Definition: op_function.hh:191
void eval() override
Reinit function of operation. Implementation in descendants.
Definition: op_function.hh:202
Class represents element or FE operations.
Definition: patch_op.hh:45
Eigen::Vector< ArenaVec< double >, Eigen::Dynamic > result_
Result matrix of operation.
Definition: patch_op.hh:184
Eigen::Map< Eigen::Matrix< ArenaVec< double >, Eigen::Dynamic, Eigen::Dynamic > > result_sub_matrix(uint i_dof)
Return map referenced result of DOF values as Eigen::Matrix.
Definition: patch_op.hh:138
uint n_dofs() const
Getter for n_dofs_.
Definition: patch_op.hh:97
std::vector< PatchOp< spacedim > * > input_ops_
Indices of operations in PatchPointValues::operations_ vector on which PatchOp is depended.
Definition: patch_op.hh:186
PatchOp< spacedim > * input_ops(uint i_op) const
Return pointer to operation of i_op index in input operation vector.
Definition: patch_op.hh:102
uint dim_
Dimension.
Definition: patch_op.hh:181
Eigen::Map< Eigen::Matrix< ArenaVec< double >, Eigen::Dynamic, Eigen::Dynamic > > result_matrix()
Return map referenced result as Eigen::Vector.
Definition: patch_op.hh:133
void allocate_const_result(ArenaVec< double > &value_vec)
Definition: patch_op.hh:127
ElemDomain domain_
Flag: BulkOp = 0, SideOp = 1.
Definition: patch_op.hh:182
void allocate_result(size_t data_size, PatchArena &arena)
Definition: patch_op.hh:122
PatchPointValues< spacedim > & ppv() const
Return reference of PatchPointValues.
Definition: patch_op.hh:155
virtual void eval()=0
Reinit function of operation. Implementation in descendants.
uint n_dofs_
Number of DOFs of FE operations (or 1 in case of element operations)
Definition: patch_op.hh:187
PatchFEValues< spacedim > * patch_fe_
Pointer to PatchFEValues object.
Definition: patch_op.hh:188
PatchArena & patch_arena() const
return reference to patch arena
std::vector< ElementAccessor< spacedim > > elem_list_
List of elements on patch.
Quadrature * get_quadrature() const
Getter for quadrature.
PatchFeData & patch_fe_data_
Reference to PatchFeData structure shared with PatchFeValues.
IntTableArena int_table_
uint n_points_
Number of points in patch.
uint n_elems_
Number of elements in patch.
Base class for quadrature rules on simplices in arbitrary dimensions.
Definition: quadrature.hh:48
Quadrature make_from_side(unsigned int sid) const
Definition: quadrature.cc:47
unsigned int size() const
Returns number of quadrature points.
Definition: quadrature.hh:86
Armor::ArmaVec< double, point_dim > point(unsigned int i) const
Returns the ith quadrature point.
Definition: quadrature.hh:151
const std::vector< double > & get_weights() const
Return a reference to the whole array of weights.
Definition: quadrature.hh:111
static Eigen::Matrix< ArenaVec< double >, dim, 1 > normal_vector_array(ArenaVec< uint > loc_side_idx_vec)
Definition: ref_element.cc:280
@ FEScalar
@ FEVectorPiola
@ FEVectorContravariant
@ FEVector
unsigned int uint
ArenaVec< double > determinant(const Eigen::Matrix< ArenaVec< double >, m, n > &A)
Calculates determinant of a rectangular matrix.
Class FEValues calculates finite element data on the actual cells such as shape function values,...
Base class of FE operations.
ElemDomain
Distinguishes bulk and side domain.
Definition: patch_op.hh:35
@ domain_side
Definition: patch_op.hh:37
@ domain_bulk
Definition: patch_op.hh:36
@ pointOp
operation is evaluated on quadrature points
@ elemOp
operation is evaluated on elements or sides
@ fixedSizeOp
operation has fixed size and it is filled during initialization