FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
shape_convert_factory.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/geometry/conformal_mesh.hpp>
10#include <kernel/geometry/index_calculator.hpp>
11#include <kernel/geometry/mesh_part.hpp>
12#include <kernel/geometry/intern/shape_convert_index.hpp>
13#include <kernel/geometry/intern/shape_convert_target.hpp>
14#include <kernel/geometry/intern/shape_convert_traits.hpp>
15#include <kernel/geometry/intern/shape_convert_vertex.hpp>
16
17namespace FEAT
18{
19 namespace Geometry
20 {
33 template<typename Mesh_>
34#ifndef DOXYGEN
35 class ShapeConvertFactory;
36#else
38 public Factory<Mesh_>
39 {
40 public:
42 typedef Mesh_ MeshType;
44 typedef ... OtherMeshType;
45
52 explicit ShapeConvertFactory(const OtherMeshType& other_mesh);
53 };
54#endif // DOXYGEN
55
61 template<
62 typename Shape_,
63 int num_coords_,
64 typename Coord_>
65 class ShapeConvertFactory<ConformalMesh<Shape_, num_coords_, Coord_> > :
66 public Factory<ConformalMesh<Shape_, num_coords_, Coord_> >
67 {
68 public:
70 typedef Shape_ ShapeType;
71 typedef typename Intern::OtherShape<Shape_>::Type OtherShapeType;
78
80 static constexpr int shape_dim = ShapeType::dimension;
81
82 protected:
83 const OtherMeshType& _other_mesh;
85 Index _num_entities_in[shape_dim + 1];
87 Index _num_entities_out[shape_dim + 1];
88
89 public:
90 explicit ShapeConvertFactory(const OtherMeshType& other_mesh) :
91 _other_mesh(other_mesh)
92 {
93 // get number of entities in input mesh
94 for(int i(0); i <= shape_dim; ++i)
95 {
96 _num_entities_out[i] = _num_entities_in[i] = _other_mesh.get_num_entities(i);
97 }
98
99 // calculate number of entities in output mesh
100 Intern::EntityCountWrapper<Intern::ShapeConvertTraits, OtherShapeType>::query(_num_entities_out);
101 }
102
103 virtual Index get_num_entities(int dim) override
104 {
105 return _num_entities_out[dim];
106 }
107
108 virtual void fill_vertex_set(VertexSetType& vertex_set) override
109 {
110 // call wrapper
111 Intern::ShapeConvertVertexWrapper<OtherShapeType, VertexSetType>
112 ::refine(vertex_set, _other_mesh.get_vertex_set(), _other_mesh.get_index_set_holder());
113 }
114
115 virtual void fill_index_sets(IndexSetHolderType& index_set_holder) override
116 {
117 // call wrapper to build essential index sets
118 Intern::ShapeConvertIndexWrapper<ShapeType>
119 ::refine(index_set_holder, _num_entities_in, _other_mesh.get_index_set_holder());
120
121 // build redundant index sets
123 }
124 }; // class ShapeConvertFactory<ConformalMesh<...>>
125
131 template<
132 typename Shape_,
133 typename Coord_>
134 class ShapeConvertFactory<MeshPart<ConformalMesh<Shape_, Shape_::dimension, Coord_> > > :
135 public Factory<MeshPart<ConformalMesh<Shape_, Shape_::dimension, Coord_> > >
136 {
137 public:
139 typedef Shape_ ShapeType;
140 typedef typename Intern::OtherShape<Shape_>::Type OtherShapeType;
144 typedef typename MeshType::VertexSetType VertexSetType;
149
151 static constexpr int shape_dim = ShapeType::dimension;
152
153 protected:
154 const OtherMeshType& _other_mesh;
156 Index _num_entities_in[shape_dim + 1];
158 Index _num_entities_out[shape_dim + 1];
159
160 public:
161 explicit ShapeConvertFactory(const OtherMeshType& other_mesh) :
162 _other_mesh(other_mesh)
163 {
164 // get number of entities in input mesh
165 for(int i(0); i <= shape_dim; ++i)
166 {
167 _num_entities_out[i] = _num_entities_in[i] = _other_mesh.get_num_entities(i);
168 }
169
170 // calculate number of entities in output mesh
171 Intern::EntityCountWrapper<Intern::ShapeConvertTraits, OtherShapeType>::query(_num_entities_out);
172
173 }
174
175 virtual Index get_num_entities(int dim)
176 {
177 return _num_entities_out[dim];
178 }
179
180 virtual int get_num_coords()
181 {
182 return _other_mesh.get_vertex_set().get_num_coords();
183 }
184
185 virtual int get_vertex_stride()
186 {
187 return _other_mesh.get_vertex_set().get_stride();
188 }
189
190 virtual void fill_vertex_set(VertexSetType& vertex_set)
191 {
192 // call wrapper
193 Intern::ShapeConvertVertexWrapper<OtherShapeType, VertexSetType>
194 ::refine(vertex_set, _other_mesh.get_vertex_set(), _other_mesh.get_index_set_holder());
195 }
196
197 virtual void fill_index_sets(IndexSetHolderType& index_set_holder)
198 {
199 // call wrapper to build essential index sets
200 Intern::ShapeConvertIndexWrapper<ShapeType>
201 ::refine(index_set_holder, _num_entities_in, _other_mesh.get_index_set_holder());
202
203 // build redundant index sets
205 }
206
207 virtual void fill_target_sets(TargetSetHolderType& /*target_set_holder*/)
208 {
209 // TODO
210 }
211 }; // class ShapeConvertFactory<MeshPart<ConformalMesh<...>>>
212 } // namespace Geometry
213} // namespace FEAT
Conformal mesh class template.
Index get_num_entities(int dim) const
Returns the number of entities.
IndexSetHolder< ShapeType > IndexSetHolderType
index set holder type
VertexSetType & get_vertex_set()
Returns a reference to the vertex set of the mesh.
Mesh Factory class template.
Definition: factory.hpp:33
Class template for partial meshes.
Definition: mesh_part.hpp:90
TargetSetHolder< ShapeType > TargetSetHolderType
Target set holder type.
Definition: mesh_part.hpp:101
IndexSetHolder< ShapeType > IndexSetHolderType
Index set holder type.
Definition: mesh_part.hpp:99
Index get_num_entities(int dim) const
Returns the number of entities.
Definition: mesh_part.hpp:311
static void compute(IndexSetHolder< Shape_ > &index_set_holder)
Routine that does the actual work.
Shape-Conversion Mesh Factory class template.
ShapeConvertFactory(const OtherMeshType &other_mesh)
Constructor.
typedef OtherMeshType
the input mesh type
FEAT namespace.
Definition: adjactor.hpp:12
std::uint64_t Index
Index data type.
Fixed-Sized Vertex Set class template.
Definition: vertex_set.hpp:37