44 #include "DTK_STKMeshEntityImpl.hpp" 45 #include "DTK_STKMeshHelpers.hpp" 47 #include <Intrepid_FieldContainer.hpp> 49 #include <stk_mesh/base/CoordinateSystems.hpp> 50 #include <stk_mesh/base/Field.hpp> 51 #include <stk_mesh/base/FieldBase.hpp> 52 #include <stk_mesh/base/MetaData.hpp> 59 const stk::mesh::Entity &stk_entity,
60 const Teuchos::Ptr<stk::mesh::BulkData> &bulk_data )
62 , d_bulk_data( bulk_data )
70 DTK_REQUIRE( Teuchos::nonnull( d_bulk_data ) );
71 return Teuchos::as<EntityId>(
72 d_bulk_data->identifier( d_extra_data->d_stk_entity ) );
79 DTK_REQUIRE( Teuchos::nonnull( d_bulk_data ) );
80 return d_bulk_data->parallel_owner_rank( d_extra_data->d_stk_entity );
87 DTK_REQUIRE( Teuchos::nonnull( d_bulk_data ) );
88 stk::mesh::EntityRank rank =
89 d_bulk_data->entity_rank( d_extra_data->d_stk_entity );
98 DTK_REQUIRE( Teuchos::nonnull( d_bulk_data ) );
99 return d_bulk_data->mesh_meta_data().spatial_dimension();
106 DTK_REQUIRE( Teuchos::nonnull( d_bulk_data ) );
108 Intrepid::FieldContainer<double> node_coords =
110 Teuchos::Array<stk::mesh::Entity>( 1, d_extra_data->d_stk_entity ),
112 DTK_CHECK( node_coords.rank() == 3 );
113 DTK_CHECK( node_coords.dimension( 0 ) == 1 );
115 double max = std::numeric_limits<double>::max();
116 bounds = Teuchos::tuple( max, max, max, -max, -max, -max );
117 int space_dim = node_coords.dimension( 2 );
118 for (
int n = 0; n < node_coords.dimension( 1 ); ++n )
120 for (
int d = 0; d < space_dim; ++d )
122 bounds[d] = std::min( bounds[d], node_coords( 0, n, d ) );
123 bounds[d + 3] = std::max( bounds[d + 3], node_coords( 0, n, d ) );
126 for (
int d = space_dim; d < 3; ++d )
137 DTK_REQUIRE( Teuchos::nonnull( d_bulk_data ) );
138 const stk::mesh::PartVector &all_parts =
139 d_bulk_data->mesh_meta_data().get_parts();
140 stk::mesh::Bucket &entity_bucket =
141 d_bulk_data->bucket( d_extra_data->d_stk_entity );
142 for (
auto part_it = all_parts.begin(); part_it != all_parts.end();
145 if ( Teuchos::as<int>( ( *part_it )->mesh_meta_data_ordinal() ) ==
148 return entity_bucket.member( **part_it );
171 Teuchos::FancyOStream &out,
172 const Teuchos::EVerbosityLevel )
const 175 d_extra_data->d_stk_entity, *d_bulk_data );
177 Intrepid::FieldContainer<double> node_coords =
179 Teuchos::Array<stk::mesh::Entity>( 1, d_extra_data->d_stk_entity ),
181 int num_node = node_coords.dimension( 1 );
182 int space_dim = node_coords.dimension( 2 );
185 out <<
"---" << std::endl;
186 out <<
"STK Mesh Entity" << std::endl;
187 out <<
"Id: " <<
id() << std::endl;
188 out <<
"Owner rank: " <<
ownerRank() << std::endl;
189 out <<
"Topology: " << topo;
190 out <<
"Node coords: " << std::endl;
191 for (
int n = 0; n < num_node; ++n )
193 out <<
" node " << n <<
": ";
194 for (
int d = 0; d < space_dim; ++d )
196 out << node_coords( 0, n, d ) <<
" ";
200 out <<
"---" << std::endl;
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...
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verb_level) const override
Provide a verbose description of the object.
int ownerRank() const override
Get the parallel rank that owns the entity.
static int getTopologicalDimensionFromRank(const stk::mesh::EntityRank stk_rank, const int space_dim)
Given a STK entity rank, get the topological dimension.
bool inBlock(const int block_id) const override
Determine if an entity is in the block with the given id.
bool onBoundary(const int boundary_id) const override
Determine if an entity is on the boundary with the given id.
Assertions and Design-by-Contract for error handling.
STKMeshEntityImpl(const stk::mesh::Entity &stk_entity, const Teuchos::Ptr< stk::mesh::BulkData > &bulk_data)
Constructor.
EntityId id() const override
Get the unique global identifier for the entity.
int topologicalDimension() const override
Return the topological dimension of the entity.
static shards::CellTopology getShardsTopology(const stk::mesh::Entity stk_entity, const stk::mesh::BulkData &bulk_data)
Given a STK entity, return its shards topology.
unsigned long int EntityId
Entity id type.
Teuchos::RCP< EntityExtraData > extraData() const override
Get the extra data on the entity.
int physicalDimension() const override
Return the physical dimension of the entity.
void boundingBox(Teuchos::Tuple< double, 6 > &bounds) const override
Return the Cartesian bounding box around an entity.