Nalu
Nalu: a generalized unstructured massively parallel low Mach flow code designed to support a variety of energy applications of interest (most notably Wind ECP) built on the Sierra Toolkit and Trilinos solver Tpetra/Epetra stack. The open source BSD, clause 3 license model has been chosen for the code base. See LICENSE for more information. http://NaluCFD.org
PromoteElement.h
Go to the documentation of this file.
1 /*------------------------------------------------------------------------*/
2 /* Copyright 2014 Sandia Corporation. */
3 /* This software is released under the license detailed */
4 /* in the file, LICENSE, which is located in the top-level NaluUnit */
5 /* directory structure */
6 /*------------------------------------------------------------------------*/
7 #ifndef PromoteElement_h
8 #define PromoteElement_h
9 
10 #include <stk_mesh/base/FieldBase.hpp>
11 #include <stk_mesh/base/CoordinateSystems.hpp>
12 
13 #include <vector>
14 #include <tuple>
15 #include <unordered_map>
16 
17 #include <stk_topology/topology.hpp>
18 #include <boost/functional/hash/hash.hpp>
19 
20 namespace stk { namespace mesh { class Part; } }
21 namespace stk { namespace mesh { class BulkData; } }
22 namespace stk { namespace mesh { class Selector; } }
23 namespace stk { namespace mesh { struct Entity; } }
24 namespace stk { namespace mesh { typedef std::vector<Part*> PartVector; } }
25 namespace stk { namespace mesh { typedef std::vector<Entity> EntityVector; } }
26 namespace stk { namespace mesh { typedef std::vector<EntityId> EntityIdVector; } }
27 namespace sierra { namespace nalu { struct ElementDescription; } }
28 typedef stk::mesh::Field<double, stk::mesh::Cartesian> VectorFieldType;
29 
30 namespace sierra {
31 namespace nalu {
32 namespace promotion {
33 
34  std::pair<stk::mesh::PartVector, stk::mesh::PartVector>
36  stk::mesh::BulkData& bulk,
37  const ElementDescription& desc,
38  const VectorFieldType& coordField,
39  const stk::mesh::PartVector& elemPartsToBePromoted,
40  stk::mesh::Part* edgePart,
41  stk::mesh::Part* facePart = nullptr);
42 
45  stk::mesh::BulkData& bulk,
46  const ElementDescription& desc,
47  const stk::mesh::PartVector& meshParts);
48 
49 } // namespace promotion
50 } // namespace naluUnit
51 } // namespace Sierra
52 
53 namespace sierra {
54 namespace nalu {
55 namespace promotion {
56 namespace internal {
57 
58  using ConnectivityMap = std::unordered_map<stk::mesh::Entity, stk::mesh::EntityIdVector>;
59 
61  {
62  std::size_t operator()(const stk::mesh::EntityIdVector& ids) const
63  {
64  return boost::hash_range(ids.begin(), ids.end());
65  }
66  };
67 
68  using NodesElemMap = std::unordered_map< stk::mesh::EntityIdVector,
69  stk::mesh::Entity,
71 
72  std::pair<stk::mesh::PartVector, stk::mesh::PartVector>
74  stk::mesh::BulkData& bulk,
75  const ElementDescription& desc,
76  const VectorFieldType& coordField,
77  const stk::mesh::PartVector& elemPartsToBePromoted,
78  stk::mesh::Part& edgePart);
79 
80  std::pair<stk::mesh::PartVector, stk::mesh::PartVector>
82  stk::mesh::BulkData& bulk,
83  const ElementDescription& desc,
84  const VectorFieldType& coordField,
85  const stk::mesh::PartVector& elemPartsToBePromoted,
86  stk::mesh::Part& edgePart,
87  stk::mesh::Part& facePart);
88 
91  stk::mesh::BulkData& bulk,
92  const int numNewNodesOnTopo,
93  const stk::mesh::Selector& selector,
94  stk::topology::rank_t parent_rank);
95 
97  const stk::mesh::BulkData& bulk,
98  const ElementDescription& desc,
99  const stk::mesh::Entity elem,
100  stk::mesh::EntityIdVector& allNodes);
101 
103  const stk::mesh::BulkData& bulk,
104  const ElementDescription& desc,
105  const ConnectivityMap& edgeConnectivity,
106  const stk::mesh::Entity elem,
107  stk::mesh::EntityIdVector& allNodes);
108 
110  const stk::mesh::BulkData& bulk,
111  const ElementDescription& desc,
112  const ConnectivityMap& faceConnectivity,
113  const stk::mesh::Entity elem,
114  stk::mesh::EntityIdVector& allNodes);
115 
117  const stk::mesh::BulkData& bulk,
118  const ElementDescription& desc,
119  const ConnectivityMap& volumeConnectivity,
120  const stk::mesh::Entity elem,
121  stk::mesh::EntityIdVector& allNodes);
122 
124  stk::mesh::BulkData& bulk,
125  const ConnectivityMap& edgeConnectivity);
126 
128  stk::mesh::BulkData& bulk,
129  const ElementDescription& desc,
130  const stk::mesh::PartVector& partsToBePromoted,
131  const ConnectivityMap& edgeConnectivity,
132  const ConnectivityMap& volumeConnectivity);
133 
135  stk::mesh::BulkData& bulk,
136  const ElementDescription& desc,
137  const stk::mesh::PartVector& partsToBePromoted,
138  const ConnectivityMap& edgeConnectivity,
139  const ConnectivityMap& faceConnectivity,
140  const ConnectivityMap& volumeConnectivity);
141 
143  const stk::mesh::BulkData& bulk,
144  const ElementDescription& desc,
145  const stk::mesh::PartVector& partsToBePromoted,
146  const VectorFieldType& coordField);
147 
148  void set_coordinates_hex(
149  const stk::mesh::BulkData& bulk,
150  const ElementDescription& desc,
151  const stk::mesh::PartVector& partsToBePromoted,
152  const VectorFieldType& coordField);
153 
155  const stk::mesh::BulkData& bulk,
156  ConnectivityMap& connectivityMap);
157 
158  void destroy_entities(
159  stk::mesh::BulkData& bulk,
160  const stk::mesh::Selector& selector,
161  stk::topology::rank_t rank);
162 
165  const ElementDescription& desc,
166  const stk::mesh::BulkData& mesh,
167  const stk::mesh::PartVector& meshParts);
168 
169  std::unordered_map<stk::mesh::Entity, stk::mesh::Entity>
171  const ElementDescription& desc,
172  const stk::mesh::BulkData& bulk,
173  const stk::mesh::PartVector& base_elem_mesh_parts);
174 
177  stk::mesh::BulkData& bulk,
178  const ElementDescription& desc,
179  const stk::mesh::PartVector& parts);
180 
181 } // namespace internal
182 } // namespace promotion
183 } // namespace naluUnit
184 } // namespace Sierra
185 
186 #endif
void add_face_nodes_to_elem_connectivity(const stk::mesh::BulkData &bulk, const ElementDescription &desc, const ConnectivityMap &faceConnectivity, const stk::mesh::Entity elem, stk::mesh::EntityIdVector &allNodes)
Definition: PromoteElement.C:569
Definition: ElementDescription.h:27
void add_edge_nodes_to_elem_connectivity(const stk::mesh::BulkData &bulk, const ElementDescription &desc, const ConnectivityMap &edgeConnectivity, const stk::mesh::Entity elem, stk::mesh::EntityIdVector &allNodes)
Definition: PromoteElement.C:544
std::vector< Part * > PartVector
Definition: Algorithm.h:16
Definition: ABLForcingAlgorithm.C:26
void set_coordinates_quad(const stk::mesh::BulkData &bulk, const ElementDescription &desc, const stk::mesh::PartVector &promotedPartVector, const VectorFieldType &coordField)
Definition: PromoteElement.C:658
void perform_parallel_consolidation_of_node_ids(const stk::mesh::BulkData &bulk, ConnectivityMap &connectivityMap)
Definition: PromoteElement.C:348
std::pair< stk::mesh::PartVector, stk::mesh::PartVector > promote_elements_hex(stk::mesh::BulkData &bulk, const ElementDescription &desc, const VectorFieldType &coordField, const stk::mesh::PartVector &partsToBePromoted, stk::mesh::Part &edgePart, stk::mesh::Part &facePart)
Definition: PromoteElement.C:134
NodesElemMap make_base_nodes_to_elem_map_at_boundary(const ElementDescription &desc, const stk::mesh::BulkData &mesh, const stk::mesh::PartVector &meshParts)
Definition: PromoteElement.C:741
stk::mesh::PartVector create_boundary_elements(stk::mesh::BulkData &bulk, const ElementDescription &desc, const stk::mesh::PartVector &parts)
Definition: PromoteElement.C:69
Definition: Algorithm.h:14
stk::mesh::Field< double, stk::mesh::Cartesian > VectorFieldType
Definition: FieldTypeDef.h:24
std::vector< EntityId > EntityIdVector
Definition: PromoteElement.h:26
std::unordered_map< stk::mesh::EntityIdVector, stk::mesh::Entity, EntityIdVectorHash > NodesElemMap
Definition: PromoteElement.h:70
void add_base_nodes_to_elem_connectivity(const stk::mesh::BulkData &bulk, const ElementDescription &desc, const stk::mesh::Entity elem, stk::mesh::EntityIdVector &allNodes)
Definition: PromoteElement.C:450
std::vector< Entity > EntityVector
Definition: PromoteElement.h:25
stk::mesh::Field< double, stk::mesh::Cartesian > VectorFieldType
Definition: PromotedElementIO.h:40
void set_coordinates_hex(const stk::mesh::BulkData &bulk, const ElementDescription &desc, const stk::mesh::PartVector &promotedPartVector, const VectorFieldType &coordField)
Definition: PromoteElement.C:695
std::size_t operator()(const stk::mesh::EntityIdVector &ids) const
Definition: PromoteElement.h:62
std::pair< stk::mesh::PartVector, stk::mesh::PartVector > promote_elements(stk::mesh::BulkData &bulk, const ElementDescription &desc, const VectorFieldType &coordField, const stk::mesh::PartVector &partsToBePromoted, stk::mesh::Part *edgePart, stk::mesh::Part *facePart)
Definition: PromoteElement.C:50
void destroy_entities(stk::mesh::BulkData &bulk, const stk::mesh::Selector &selector, stk::topology::rank_t rank)
Definition: PromoteElement.C:640
std::unordered_map< stk::mesh::Entity, stk::mesh::Entity > exposed_side_to_super_elem_map(const ElementDescription &desc, const stk::mesh::BulkData &bulk, const stk::mesh::PartVector &base_elem_mesh_parts)
Definition: PromoteElement.C:775
void add_volume_nodes_to_elem_connectivity(const stk::mesh::BulkData &bulk, const ElementDescription &desc, const ConnectivityMap &volumeConnectivity, const stk::mesh::Entity elem, stk::mesh::EntityIdVector &allNodes)
Definition: PromoteElement.C:599
void create_nodes_for_connectivity_map(stk::mesh::BulkData &bulk, const ConnectivityMap &map)
Definition: PromoteElement.C:402
std::pair< stk::mesh::PartVector, stk::mesh::PartVector > promote_elements_quad(stk::mesh::BulkData &bulk, const ElementDescription &desc, const VectorFieldType &coordField, const stk::mesh::PartVector &partsToBePromoted, stk::mesh::Part &edgePart)
Definition: PromoteElement.C:88
stk::mesh::Field< double, stk::mesh::Cartesian > VectorFieldType
Definition: PromoteElement.h:28
stk::mesh::PartVector create_super_elements(stk::mesh::BulkData &bulk, const ElementDescription &desc, const stk::mesh::PartVector &elemPartsToBePromoted, const ConnectivityMap &edgeConnectivity, const ConnectivityMap &volumeConnectivity)
Definition: PromoteElement.C:213
ConnectivityMap connectivity_map_for_parent_rank(stk::mesh::BulkData &bulk, const int numNewNodesOnTopo, const stk::mesh::Selector &selector, stk::topology::rank_t parent_rank)
Definition: PromoteElement.C:424
std::unordered_map< stk::mesh::Entity, stk::mesh::EntityIdVector > ConnectivityMap
Definition: PromoteElement.h:58