FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
mapping.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
8// includes, FEAT
9#include <kernel/trafo/mapping_base.hpp>
10#include <kernel/trafo/isoparam/evaluator.hpp>
11#include <kernel/geometry/mesh_part.hpp>
12#include <kernel/geometry/atlas/chart.hpp>
13
14namespace FEAT
15{
16 namespace Trafo
17 {
24 namespace Isoparam
25 {
27 namespace Intern
28 {
29 template<typename Shape_, int dim_ = Shape_::dimension-1>
30 struct PartChartHelper
31 {
32 template<typename AVC_, typename Chart_>
33 static void emplace(const Geometry::TargetSetHolder<Shape_>& tsh, AVC_& v, const Chart_& chart)
34 {
35 PartChartHelper<Shape_, dim_-1>::emplace(tsh, v, chart);
36
37 const auto& trg = tsh.template get_target_set<dim_>();
38 for(Index i(0); i < trg.get_num_entities(); ++i)
39 {
40 v[dim_].at(trg[i]) = &chart;
41 }
42 }
43 };
44
45 template<typename Shape_>
46 struct PartChartHelper<Shape_,0>
47 {
48 template<typename AVC_, typename Chart_>
49 static void emplace(const Geometry::TargetSetHolder<Shape_>&, AVC_&, const Chart_&)
50 {
51 // nothing to do here
52 }
53 };
54 } // namespace Intern
56
82 template<typename Mesh_, int degree_>
83 class Mapping :
84 public MappingBase<Mesh_>
85 {
86 public:
87 static_assert(degree_ > 0, "invalid mapping degree");
88 static_assert(degree_ < 4, "invalid mapping degree");
89
93 typedef Mesh_ MeshType;
97 typedef typename MeshType::VertexSetType::CoordType CoordType;
99 typedef typename MeshType::ShapeType ShapeType;
102 typedef typename Shape::FaceTraits<ShapeType, ShapeType::dimension - 1>::ShapeType FacetType;
103
105 static constexpr int shape_dim = ShapeType::dimension;
106
107 protected:
108 // for each shape dimension, a vector of charts
109 std::array<std::vector<const ChartType*>, shape_dim+1> _shape_charts;
110
111 public:
113 template<
114 typename Shape_ = ShapeType,
115 typename CoordType_ = Real>
117 {
118 private:
121
122 public:
125 };
126
127 public:
134 explicit Mapping(MeshType& mesh) :
135 BaseClass(mesh)
136 {
137 // allocate chart vectors
138 for(int dim(1); dim <= shape_dim; ++dim)
139 {
140 _shape_charts.at(std::size_t(dim)).resize(mesh.get_num_entities(dim), nullptr);
141 }
142 }
143
154 {
155 Intern::PartChartHelper<ShapeType>::emplace(mesh_part.get_target_set_holder(), _shape_charts, chart);
156 }
157
162 {
163 for(int dim(1); dim <= shape_dim; ++dim)
164 {
165 for(auto& x : _shape_charts.at(std::size_t(dim)))
166 x = nullptr;
167 }
168 }
169
175 const std::vector<const ChartType*>& get_charts_vector(int dim) const
176 {
177 XASSERTM((dim >= 0) && (dim <= shape_dim), "invalid dimension");
178 return _shape_charts.at(std::size_t(dim));
179 }
180 }; // class Mapping<...>
181 } // namespace Isoparam
182 } // namespace Trafo
183} // namespace FEAT
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Definition: assertion.hpp:263
Class template for partial meshes.
Definition: mesh_part.hpp:90
Trafo evaluator class template.
Definition: mapping.hpp:117
Trafo::Isoparam::Evaluator< Mapping, EvalPolicy, degree_ > Type
evaluator type
Definition: mapping.hpp:124
Trafo::StandardEvalPolicy< Shape_, CoordType_, MeshType::world_dim > EvalPolicy
evaluation policy
Definition: mapping.hpp:120
Standard transformation mapping class template.
Definition: mapping.hpp:85
Shape::FaceTraits< ShapeType, ShapeType::dimension-1 >::ShapeType FacetType
Definition: mapping.hpp:102
MappingBase< Mesh_ > BaseClass
base-class typedef
Definition: mapping.hpp:91
Mapping(MeshType &mesh)
Constructor.
Definition: mapping.hpp:134
const std::vector< const ChartType * > & get_charts_vector(int dim) const
Return the shape-charts vector.
Definition: mapping.hpp:175
static constexpr int shape_dim
our shape dimension
Definition: mapping.hpp:105
void clear_charts()
Clears all added mesh-part/chart pairs.
Definition: mapping.hpp:161
void add_meshpart_chart(const Geometry::MeshPart< MeshType > &mesh_part, const Geometry::Atlas::ChartBase< MeshType > &chart)
Adds a mesh-part and its associated chart to the trafo.
Definition: mapping.hpp:153
Geometry::Atlas::ChartBase< MeshType > ChartType
chart type
Definition: mapping.hpp:95
MeshType::VertexSetType::CoordType CoordType
data type
Definition: mapping.hpp:97
MeshType::ShapeType ShapeType
shape type
Definition: mapping.hpp:99
Trafo-Mapping base class.
FEAT namespace.
Definition: adjactor.hpp:12
double Real
Real data type.
Face traits tag struct template.
Definition: shape.hpp:106
Standard evaluation policy class template.
Definition: base.hpp:44