41 #include "DTK_STKMeshEntityLocalMap.hpp" 43 #include "DTK_IntrepidCellLocalMap.hpp" 45 #include "DTK_STKMeshHelpers.hpp" 47 #include <Intrepid_FieldContainer.hpp> 49 #include <stk_mesh/base/MetaData.hpp> 50 #include <stk_mesh/base/Part.hpp> 51 #include <stk_mesh/base/Selector.hpp> 52 #include <stk_topology/topology.hpp> 59 const Teuchos::RCP<stk::mesh::BulkData> &bulk_data )
60 : d_bulk_data( bulk_data )
61 , d_inclusion_tol( 1.0e-6 )
67 void STKMeshEntityLocalMap::setParameters(
68 const Teuchos::ParameterList ¶meters )
70 if ( parameters.isParameter(
"Point Inclusion Tolerance" ) )
72 d_inclusion_tol = parameters.get<
double>(
"Point Inclusion Tolerance" );
82 const stk::mesh::Entity &stk_entity =
84 stk::mesh::EntityRank rank = d_bulk_data->entity_rank( stk_entity );
85 shards::CellTopology entity_topo =
89 Intrepid::FieldContainer<double> entity_coords =
91 Teuchos::Array<stk::mesh::Entity>( 1, stk_entity ), *d_bulk_data );
94 if ( rank == stk::topology::ELEM_RANK )
96 return IntrepidCellLocalMap::measure( entity_topo, entity_coords );
100 else if ( rank == stk::topology::FACE_RANK )
102 bool not_implemented =
true;
103 DTK_INSIST( !not_implemented );
110 bool bad_rank =
true;
111 DTK_INSIST( !bad_rank );
120 const Entity &entity,
const Teuchos::ArrayView<double> &
centroid )
const 123 const stk::mesh::Entity &stk_entity =
125 stk::mesh::EntityRank rank = d_bulk_data->entity_rank( stk_entity );
128 if ( rank == stk::topology::ELEM_RANK )
130 shards::CellTopology entity_topo =
132 Intrepid::FieldContainer<double> entity_coords =
134 Teuchos::Array<stk::mesh::Entity>( 1, stk_entity ),
136 IntrepidCellLocalMap::centroid( entity_topo, entity_coords, centroid );
140 else if ( rank == stk::topology::FACE_RANK )
142 bool not_implemented =
true;
143 DTK_INSIST( !not_implemented );
147 else if ( rank == stk::topology::NODE_RANK )
149 Intrepid::FieldContainer<double> entity_coords =
151 Teuchos::Array<stk::mesh::Entity>( 1, stk_entity ),
153 centroid.assign( entity_coords.getData()() );
159 bool bad_rank =
true;
160 DTK_INSIST( !bad_rank );
169 const Teuchos::ArrayView<const double> &physical_point )
const 172 const stk::mesh::Entity &stk_entity =
174 stk::mesh::EntityRank rank = d_bulk_data->entity_rank( stk_entity );
177 if ( rank == stk::topology::ELEM_RANK )
184 else if ( rank == stk::topology::FACE_RANK )
186 bool not_implemented =
true;
187 DTK_INSIST( !not_implemented );
194 bool bad_rank =
true;
195 DTK_INSIST( !bad_rank );
209 const Teuchos::ArrayView<const double> &physical_point,
210 const Teuchos::ArrayView<double> &reference_point )
const 213 const stk::mesh::Entity &stk_entity =
215 stk::mesh::EntityRank rank = d_bulk_data->entity_rank( stk_entity );
218 if ( rank == stk::topology::ELEM_RANK )
220 shards::CellTopology entity_topo =
222 Intrepid::FieldContainer<double> entity_coords =
224 Teuchos::Array<stk::mesh::Entity>( 1, stk_entity ),
226 IntrepidCellLocalMap::mapToReferenceFrame(
227 entity_topo, entity_coords, physical_point, reference_point );
231 else if ( rank == stk::topology::FACE_RANK )
233 bool not_implemented =
true;
234 DTK_INSIST( !not_implemented );
241 bool bad_rank =
true;
242 DTK_INSIST( !bad_rank );
254 const Teuchos::ArrayView<const double> &reference_point )
const 257 const stk::mesh::Entity &stk_entity =
259 stk::mesh::EntityRank rank = d_bulk_data->entity_rank( stk_entity );
260 shards::CellTopology entity_topo =
264 if ( rank == stk::topology::ELEM_RANK )
266 return IntrepidCellLocalMap::checkPointInclusion(
267 entity_topo, reference_point, d_inclusion_tol );
271 else if ( rank == stk::topology::FACE_RANK )
273 bool not_implemented =
true;
274 DTK_INSIST( !not_implemented );
281 bool bad_rank =
true;
282 DTK_INSIST( !bad_rank );
293 const Teuchos::ArrayView<const double> &reference_point,
294 const Teuchos::ArrayView<double> &physical_point )
const 297 const stk::mesh::Entity &stk_entity =
299 stk::mesh::EntityRank rank = d_bulk_data->entity_rank( stk_entity );
302 if ( rank == stk::topology::ELEM_RANK )
304 shards::CellTopology entity_topo =
306 Intrepid::FieldContainer<double> entity_coords =
308 Teuchos::Array<stk::mesh::Entity>( 1, stk_entity ),
310 IntrepidCellLocalMap::mapToPhysicalFrame(
311 entity_topo, entity_coords, reference_point, physical_point );
315 else if ( rank == stk::topology::FACE_RANK )
317 bool not_implemented =
true;
318 DTK_INSIST( !not_implemented );
324 bool bad_rank =
true;
325 DTK_INSIST( !bad_rank );
333 const Teuchos::ArrayView<const double> &reference_point,
334 const Teuchos::ArrayView<double> &normal )
const 337 const stk::mesh::Entity &stk_entity =
339 stk::mesh::EntityRank rank = d_bulk_data->entity_rank( stk_entity );
342 if ( rank == stk::topology::FACE_RANK )
344 bool not_implemented =
true;
345 DTK_INSIST( !not_implemented );
351 bool bad_rank =
true;
352 DTK_INSIST( !bad_rank );
static Intrepid::FieldContainer< double > getEntityNodeCoordinates(const Teuchos::Array< stk::mesh::Entity > &stk_entities, const stk::mesh::BulkData &bulk_data)
Given a STK entity, return the coordinates of its nodes in a field container ordered by canonical nod...
Geometric entity interface definition.
static const stk::mesh::Entity & extractEntity(const Entity dtk_entity)
Given a DTK entity, extract the STK entity.
virtual bool isSafeToMapToReferenceFrame(const Entity &entity, const Teuchos::ArrayView< const double > &physical_point) const
(Safeguard the reverse map) Perform a safeguard check for mapping a point to the reference space of a...
Assertions and Design-by-Contract for error handling.
void mapToPhysicalFrame(const Entity &entity, const Teuchos::ArrayView< const double > &reference_point, const Teuchos::ArrayView< double > &physical_point) const override
(Forward Map) Map a reference point to the physical space of an entity.
bool checkPointInclusion(const Entity &entity, const Teuchos::ArrayView< const double > &reference_point) const override
Determine if a reference point is in the parameterized space of an entity.
bool isSafeToMapToReferenceFrame(const Entity &entity, const Teuchos::ArrayView< const double > &physical_point) const override
(Safeguard the reverse map) Perform a safeguard check for mapping a point to the reference space of a...
static shards::CellTopology getShardsTopology(const stk::mesh::Entity stk_entity, const stk::mesh::BulkData &bulk_data)
Given a STK entity, return its shards topology.
double measure(const Entity &entity) const override
Return the entity measure with respect to the parameteric dimension (volume for a 3D entity...
void centroid(const Entity &entity, const Teuchos::ArrayView< double > ¢roid) const override
Return the centroid of the entity.
void normalAtReferencePoint(const Entity &entity, const Entity &parent_entity, const Teuchos::ArrayView< const double > &reference_point, const Teuchos::ArrayView< double > &normal) const override
Compute the normal on a face (3D) or edge (2D) at a given reference point. A default implementation i...
STKMeshEntityLocalMap(const Teuchos::RCP< stk::mesh::BulkData > &bulk_data)
Constructor.
bool mapToReferenceFrame(const Entity &entity, const Teuchos::ArrayView< const double > &physical_point, const Teuchos::ArrayView< double > &reference_point) const override
(Reverse Map) Map a point to the reference space of an entity. Return the parameterized point...
A stateless class of projection primitive operations.