DataTransferKit - Multiphysics Solution Transfer Services  2.0
DTK_STKMeshHelpers.hpp
1 //---------------------------------------------------------------------------//
2 /*
3  Copyright (c) 2012, Stuart R. Slattery
4  All rights reserved.
5 
6  Redistribution and use in source and binary forms, with or without
7  modification, are permitted provided that the following conditions are
8  met:
9 
10  *: Redistributions of source code must retain the above copyright
11  notice, this list of conditions and the following disclaimer.
12 
13  *: Redistributions in binary form must reproduce the above copyright
14  notice, this list of conditions and the following disclaimer in the
15  documentation and/or other materials provided with the distribution.
16 
17  *: Neither the name of the University of Wisconsin - Madison nor the
18  names of its contributors may be used to endorse or promote products
19  derived from this software without specific prior written permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33 //---------------------------------------------------------------------------//
39 //---------------------------------------------------------------------------//
40 
41 #ifndef DTK_STKMESHHELPERS_HPP
42 #define DTK_STKMESHHELPERS_HPP
43 
44 #include <string>
45 
46 #include "DTK_Entity.hpp"
47 #include "DTK_Types.hpp"
48 
49 #include <Teuchos_Array.hpp>
50 #include <Teuchos_ParameterList.hpp>
51 
52 #include <Shards_CellTopology.hpp>
53 
54 #include <Intrepid_FieldContainer.hpp>
55 
56 #include <stk_mesh/base/BulkData.hpp>
57 #include <stk_mesh/base/Entity.hpp>
58 #include <stk_mesh/base/EntityKey.hpp>
59 
60 namespace DataTransferKit
61 {
62 //---------------------------------------------------------------------------//
67 //---------------------------------------------------------------------------//
69 {
70  public:
74  static const stk::mesh::Entity &extractEntity( const Entity dtk_entity );
75 
79  static stk::mesh::EntityRank
80  getRankFromTopologicalDimension( const int topo_dim, const int space_dim );
81 
85  static int
86  getTopologicalDimensionFromRank( const stk::mesh::EntityRank stk_rank,
87  const int space_dim );
88 
92  static stk::mesh::EntityKey getKeyFromEntity( const Entity dtk_entity );
93 
97  static shards::CellTopology
98  getShardsTopology( const stk::mesh::Entity stk_entity,
99  const stk::mesh::BulkData &bulk_data );
100 
105  static Intrepid::FieldContainer<double> getEntityNodeCoordinates(
106  const Teuchos::Array<stk::mesh::Entity> &stk_entities,
107  const stk::mesh::BulkData &bulk_data );
108 
109  private:
115  template <class FieldType>
116  static Intrepid::FieldContainer<double> extractEntityNodeCoordinates(
117  const Teuchos::Array<stk::mesh::Entity> &stk_entities,
118  const stk::mesh::BulkData &bulk_data, const int space_dim );
119 };
120 
121 //---------------------------------------------------------------------------//
122 
123 } // end namespace DataTransferKit
124 
125 //---------------------------------------------------------------------------//
126 // Template includes.
127 //---------------------------------------------------------------------------//
128 
129 #include "DTK_STKMeshHelpers_impl.hpp"
130 
131 //---------------------------------------------------------------------------//
132 
133 #endif // end DTK_STKMESHHELPERS_HPP
134 
135 //---------------------------------------------------------------------------//
136 // end DTK_STKMeshHelpers.hpp
137 //---------------------------------------------------------------------------//
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.
Definition: DTK_Entity.hpp:61
static const stk::mesh::Entity & extractEntity(const Entity dtk_entity)
Given a DTK entity, extract the STK entity.
static int getTopologicalDimensionFromRank(const stk::mesh::EntityRank stk_rank, const int space_dim)
Given a STK entity rank, get the topological dimension.
static stk::mesh::EntityKey getKeyFromEntity(const Entity dtk_entity)
Given a DTK entity, return the corresponding STK entity key.
static shards::CellTopology getShardsTopology(const stk::mesh::Entity stk_entity, const stk::mesh::BulkData &bulk_data)
Given a STK entity, return its shards topology.
static stk::mesh::EntityRank getRankFromTopologicalDimension(const int topo_dim, const int space_dim)
Given a topological dimension, get the STK entity rank.
A stateless class of helpers for STK mesh.
DTK_BasicEntitySet.cpp.