43#ifndef __Panzer_STK_Interface_hpp__
44#define __Panzer_STK_Interface_hpp__
46#include <Teuchos_RCP.hpp>
47#include <Teuchos_DefaultMpiComm.hpp>
49#include <stk_mesh/base/Types.hpp>
50#include <stk_mesh/base/MetaData.hpp>
51#include <stk_mesh/base/BulkData.hpp>
52#include <stk_mesh/base/Field.hpp>
53#include <stk_mesh/base/FieldBase.hpp>
54#include <stk_mesh/base/MetaData.hpp>
55#include <stk_mesh/base/CoordinateSystems.hpp>
57#include "Kokkos_Core.hpp"
59#include <Shards_CellTopology.hpp>
60#include <Shards_CellTopologyData.h>
62#include <PanzerAdaptersSTK_config.hpp>
63#include <Kokkos_ViewFactory.hpp>
65#include <unordered_map>
67#ifdef PANZER_HAVE_IOSS
68#include <stk_io/StkMeshIoBroker.hpp>
71#ifdef PANZER_HAVE_PERCEPT
74 class URP_Heterogeneous_3D;
80class PeriodicBC_MatcherBase;
87 ElementDescriptor(stk::mesh::EntityId gid,
const std::vector<stk::mesh::EntityId> & nodes);
94 std::vector<stk::mesh::EntityId>
nodes_;
101Teuchos::RCP<ElementDescriptor>
137 void addElementBlock(
const std::string & name,
const CellTopologyData * ctData);
143 const std::string & edgeBlockName,
144 const stk::topology & topology);
146 const std::string & edgeBlockName,
147 const CellTopologyData * ctData);
152 const std::string & faceBlockName,
153 const stk::topology & topology);
155 const std::string & faceBlockName,
156 const CellTopologyData * ctData);
160 void addSideset(
const std::string & name,
const CellTopologyData * ctData);
168 void addSolutionField(
const std::string & fieldName,
const std::string & blockId);
172 void addCellField(
const std::string & fieldName,
const std::string & blockId);
176 void addEdgeField(
const std::string & fieldName,
const std::string & blockId);
180 void addFaceField(
const std::string & fieldName,
const std::string & blockId);
191 const std::vector<std::string> & coordField,
192 const std::string & dispPrefix);
213 void initialize(stk::ParallelMachine parallelMach,
bool setupIO=
true,
214 const bool buildRefinementSupport =
false);
239 void addNode(stk::mesh::EntityId gid,
const std::vector<double> & coord);
241 void addElement(
const Teuchos::RCP<ElementDescriptor> & ed,stk::mesh::Part * block);
296 std::vector<stk::mesh::EntityId> & subcellIds)
const;
300 void getMyElements(std::vector<stk::mesh::Entity> & elements)
const;
304 void getMyElements(
const std::string & blockID,std::vector<stk::mesh::Entity> & elements)
const;
313 void getNeighborElements(
const std::string & blockID,std::vector<stk::mesh::Entity> & elements)
const;
317 void getMyEdges(std::vector<stk::mesh::Entity> & edges)
const;
326 void getMyEdges(
const std::string & edgeBlockName,std::vector<stk::mesh::Entity> & edges)
const;
336 void getMyEdges(
const std::string & edgeBlockName,
const std::string & blockName,std::vector<stk::mesh::Entity> & edges)
const;
345 void getAllEdges(
const std::string & edgeBlockName,std::vector<stk::mesh::Entity> & edges)
const;
355 void getAllEdges(
const std::string & edgeBlockName,
const std::string & blockName,std::vector<stk::mesh::Entity> & edges)
const;
359 void getMyFaces(std::vector<stk::mesh::Entity> & faces)
const;
368 void getMyFaces(
const std::string & faceBlockName,std::vector<stk::mesh::Entity> & faces)
const;
378 void getMyFaces(
const std::string & faceBlockName,
const std::string & blockName,std::vector<stk::mesh::Entity> & faces)
const;
387 void getAllFaces(
const std::string & faceBlockName,std::vector<stk::mesh::Entity> & faces)
const;
397 void getAllFaces(
const std::string & faceBlockName,
const std::string & blockName,std::vector<stk::mesh::Entity> & faces)
const;
406 void getMySides(
const std::string & sideName,std::vector<stk::mesh::Entity> & sides)
const;
416 void getMySides(
const std::string & sideName,
const std::string & blockName,std::vector<stk::mesh::Entity> & sides)
const;
425 void getAllSides(
const std::string & sideName,std::vector<stk::mesh::Entity> & sides)
const;
435 void getAllSides(
const std::string & sideName,
const std::string & blockName,std::vector<stk::mesh::Entity> & sides)
const;
446 void getMyNodes(
const std::string & sideName,
const std::string & blockName,std::vector<stk::mesh::Entity> & nodes)
const;
456 stk::mesh::Entity
findConnectivityById(stk::mesh::Entity src, stk::mesh::EntityRank tgt_rank,
unsigned rel_id)
const;
471 const bool append =
false);
492 const bool append =
false,
493 const bool append_after_restart_time =
false,
494 const double restart_time = 0.0);
533 const std::string& key,
557 const std::string& key,
558 const double& value);
581 const std::string& key,
582 const std::vector<int>& value);
605 const std::string& key,
606 const std::vector<double>& value);
612 Teuchos::RCP<const Teuchos::Comm<int> >
getComm()
const;
617#ifdef PANZER_HAVE_PERCEPT
619 Teuchos::RCP<percept::PerceptMesh> getRefinedMesh()
const
620 { TEUCHOS_ASSERT(Teuchos::nonnull(refinedMesh_));
return refinedMesh_; }
626 {
if(
bulkData_==Teuchos::null)
return false;
627 return bulkData_->in_modifiable_state(); }
689 std::map<std::string, stk::mesh::Part*>::const_iterator itr =
elementBlocks_.find(name);
697 std::map<std::string, stk::mesh::Part*>::const_iterator itr =
edgeBlocks_.find(name);
705 std::map<std::string, stk::mesh::Part*>::const_iterator itr =
faceBlocks_.find(name);
717 return (itr !=
sidesets_.end()) ? itr->second :
nullptr;
727 return (itr !=
nodesets_.end()) ? itr->second :
nullptr;
743 void getNodeIdsForElement(stk::mesh::Entity element,std::vector<stk::mesh::EntityId> & nodeIds)
const;
748 std::vector<int> & relIds)
const;
753 std::vector<int> & relIds,
unsigned int matchType)
const;
757 void getElementsSharingNodes(
const std::vector<stk::mesh::EntityId> nodeId,std::vector<stk::mesh::Entity> & elements)
const;
790 std::size_t
edgeLocalId(stk::mesh::Entity elmt)
const;
794 std::size_t
edgeLocalId(stk::mesh::EntityId gid)
const;
816 std::size_t
faceLocalId(stk::mesh::Entity elmt)
const;
820 std::size_t
faceLocalId(stk::mesh::EntityId gid)
const;
835 {
return bulkData_->parallel_owner_rank(entity); }
839 inline bool isValid(stk::mesh::Entity entity)
const
851 const std::string & blockId)
const;
857 stk::mesh::Field<double> *
getCellField(
const std::string & fieldName,
858 const std::string & blockId)
const;
864 stk::mesh::Field<double> *
getEdgeField(
const std::string & fieldName,
865 const std::string & blockId)
const;
871 stk::mesh::Field<double> *
getFaceField(
const std::string & fieldName,
872 const std::string & blockId)
const;
898 template <
typename ArrayT>
900 const std::vector<std::size_t> & localElementIds,
const ArrayT & solutionValues,
double scaleValue=1.0);
916 template <
typename ArrayT>
918 const std::vector<std::size_t> & localElementIds,ArrayT & solutionValues)
const;
934 template <
typename ArrayT>
935 void setCellFieldData(
const std::string & fieldName,
const std::string & blockId,
936 const std::vector<std::size_t> & localElementIds,
const ArrayT & solutionValues,
double scaleValue=1.0);
962 template <
typename ArrayT>
963 void setEdgeFieldData(
const std::string & fieldName,
const std::string & blockId,
964 const std::vector<std::size_t> & localEdgeIds,
const ArrayT & edgeValues,
double scaleValue=1.0);
980 template <
typename ArrayT>
981 void setFaceFieldData(
const std::string & fieldName,
const std::string & blockId,
982 const std::vector<std::size_t> & localFaceIds,
const ArrayT & faceValues,
double scaleValue=1.0);
992 template <
typename ArrayT>
993 void getElementVertices(
const std::vector<std::size_t> & localIds, ArrayT & vertices)
const;
1003 template <
typename ArrayT>
1004 void getElementVertices(
const std::vector<stk::mesh::Entity> & elements, ArrayT & vertices)
const;
1015 template <
typename ArrayT>
1016 void getElementVertices(
const std::vector<std::size_t> & localIds,
const std::string & eBlock, ArrayT & vertices)
const;
1027 template <
typename ArrayT>
1028 void getElementVertices(
const std::vector<stk::mesh::Entity> & elements,
const std::string & eBlock, ArrayT & vertices)
const;
1038 template <
typename ArrayT>
1049 template <
typename ArrayT>
1061 template <
typename ArrayT>
1062 void getElementVerticesNoResize(
const std::vector<std::size_t> & localIds,
const std::string & eBlock, ArrayT & vertices)
const;
1073 template <
typename ArrayT>
1074 void getElementVerticesNoResize(
const std::vector<stk::mesh::Entity> & elements,
const std::string & eBlock, ArrayT & vertices)
const;
1081 stk::mesh::EntityRank
getFaceRank()
const {
return stk::topology::FACE_RANK; }
1082 stk::mesh::EntityRank
getEdgeRank()
const {
return stk::topology::EDGE_RANK; }
1083 stk::mesh::EntityRank
getNodeRank()
const {
return stk::topology::NODE_RANK; }
1103 const std::vector<Teuchos::RCP<const PeriodicBC_MatcherBase> > &
1109 std::vector<Teuchos::RCP<const PeriodicBC_MatcherBase> > &
1135 void addPeriodicBCs(
const std::vector<Teuchos::RCP<const PeriodicBC_MatcherBase> > & bc_vec)
1140 std::pair<Teuchos::RCP<std::vector<std::pair<std::size_t,std::size_t> > >, Teuchos::RCP<std::vector<unsigned int> > >
1149 void print(std::ostream & os)
const;
1157 Teuchos::RCP<const shards::CellTopology>
getCellTopology(
const std::string & eBlock)
const;
1180 void rebalance(
const Teuchos::ParameterList & params);
1219 template <
typename ArrayT>
1220 void getElementVertices_FromField(
const std::vector<stk::mesh::Entity> & elements,
const std::string & eBlock, ArrayT & vertices)
const;
1222 template <
typename ArrayT>
1224 const std::string & eBlock, ArrayT & vertices)
const;
1235 template <
typename ArrayT>
1238 template <
typename ArrayT>
1246 void refineMesh(
const int numberOfLevels,
const bool deleteParentElements);
1276 Teuchos::RCP<Teuchos::MpiComm<int> >
getSafeCommunicator(stk::ParallelMachine parallelMach)
const;
1288 bool isMeshCoordField(
const std::string & eBlock,
const std::string & fieldName,
int & axis)
const;
1305 template <
typename ArrayT>
1306 void setDispFieldData(
const std::string & fieldName,
const std::string & blockId,
int axis,
1307 const std::vector<std::size_t> & localElementIds,
const ArrayT & solutionValues);
1314#ifdef PANZER_HAVE_PERCEPT
1315 Teuchos::RCP<percept::PerceptMesh> refinedMesh_;
1316 Teuchos::RCP<percept::URP_Heterogeneous_3D> breakPattern_;
1368#ifdef PANZER_HAVE_IOSS
1370 Teuchos::RCP<stk::io::StkMeshIoBroker> meshData_;
1377 enum class GlobalVariable
1401 const GlobalVariable& flag);
1406 Teuchos::ParameterList globalData_;
1450template <
typename ArrayT>
1452 const std::vector<std::size_t> & localElementIds,
const ArrayT & solutionValues,
double scaleValue)
1455 auto solutionValues_h = Kokkos::create_mirror_view(solutionValues);
1456 Kokkos::deep_copy(solutionValues_h, solutionValues);
1458 int field_axis = -1;
1460 setDispFieldData(fieldName,blockId,field_axis,localElementIds,solutionValues_h);
1466 for(std::size_t cell=0;cell<localElementIds.size();cell++) {
1467 std::size_t localId = localElementIds[cell];
1468 stk::mesh::Entity element = elements[localId];
1471 const size_t num_nodes =
bulkData_->num_nodes(element);
1472 stk::mesh::Entity
const* nodes =
bulkData_->begin_nodes(element);
1473 for(std::size_t i=0; i<num_nodes; ++i) {
1474 stk::mesh::Entity node = nodes[i];
1476 double * solnData = stk::mesh::field_data(*
field,node);
1478 solnData[0] = scaleValue*solutionValues_h(cell,i);
1483template <
typename ArrayT>
1485 const std::vector<std::size_t> & localElementIds,
const ArrayT & dispValues)
1487 TEUCHOS_ASSERT(axis>=0);
1494 for(std::size_t cell=0;cell<localElementIds.size();cell++) {
1495 std::size_t localId = localElementIds[cell];
1496 stk::mesh::Entity element = elements[localId];
1499 const size_t num_nodes =
bulkData_->num_nodes(element);
1500 stk::mesh::Entity
const* nodes =
bulkData_->begin_nodes(element);
1501 for(std::size_t i=0; i<num_nodes; ++i) {
1502 stk::mesh::Entity node = nodes[i];
1504 double * solnData = stk::mesh::field_data(*
field,node);
1505 double * coordData = stk::mesh::field_data(coord_field,node);
1507 solnData[0] = dispValues(cell,i)-coordData[axis];
1512template <
typename ArrayT>
1514 const std::vector<std::size_t> & localElementIds,ArrayT & solutionValues)
const
1518 solutionValues = Kokkos::createDynRankView(solutionValues,
1520 localElementIds.size(),
1521 bulkData_->num_nodes(elements[localElementIds[0]]));
1525 for(std::size_t cell=0;cell<localElementIds.size();cell++) {
1526 std::size_t localId = localElementIds[cell];
1527 stk::mesh::Entity element = elements[localId];
1530 const size_t num_nodes =
bulkData_->num_nodes(element);
1531 stk::mesh::Entity
const* nodes =
bulkData_->begin_nodes(element);
1532 for(std::size_t i=0; i<num_nodes; ++i) {
1533 stk::mesh::Entity node = nodes[i];
1535 double * solnData = stk::mesh::field_data(*
field,node);
1537 solutionValues(cell,i) = solnData[0];
1542template <
typename ArrayT>
1544 const std::vector<std::size_t> & localElementIds,
const ArrayT & solutionValues,
double scaleValue)
1550 auto solutionValues_h = Kokkos::create_mirror_view(solutionValues);
1551 Kokkos::deep_copy(solutionValues_h, solutionValues);
1553 for(std::size_t cell=0;cell<localElementIds.size();cell++) {
1554 std::size_t localId = localElementIds[cell];
1555 stk::mesh::Entity element = elements[localId];
1557 double * solnData = stk::mesh::field_data(*
field,element);
1558 TEUCHOS_ASSERT(solnData!=0);
1559 solnData[0] = scaleValue*solutionValues_h.access(cell,0);
1563template <
typename ArrayT>
1565 const std::vector<std::size_t> & localEdgeIds,
const ArrayT & edgeValues,
double scaleValue)
1571 auto edgeValues_h = Kokkos::create_mirror_view(edgeValues);
1572 Kokkos::deep_copy(edgeValues_h, edgeValues);
1574 for(std::size_t idx=0;idx<localEdgeIds.size();idx++) {
1575 std::size_t localId = localEdgeIds[idx];
1576 stk::mesh::Entity edge = edges[localId];
1578 double * solnData = stk::mesh::field_data(*
field,edge);
1579 TEUCHOS_ASSERT(solnData!=0);
1580 solnData[0] = scaleValue*edgeValues_h.access(idx,0);
1584template <
typename ArrayT>
1586 const std::vector<std::size_t> & localFaceIds,
const ArrayT & faceValues,
double scaleValue)
1592 auto faceValues_h = Kokkos::create_mirror_view(faceValues);
1593 Kokkos::deep_copy(faceValues_h, faceValues);
1595 for(std::size_t idx=0;idx<localFaceIds.size();idx++) {
1596 std::size_t localId = localFaceIds[idx];
1597 stk::mesh::Entity face = faces[localId];
1599 double * solnData = stk::mesh::field_data(*
field,face);
1600 TEUCHOS_ASSERT(solnData!=0);
1601 solnData[0] = scaleValue*faceValues_h.access(idx,0);
1605template <
typename ArrayT>
1616 std::vector<stk::mesh::Entity> selected_elements;
1617 for(std::size_t cell=0;cell<localElementIds.size();cell++)
1618 selected_elements.push_back(elements[localElementIds[cell]]);
1623 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
1624 "STK_Interface::getElementVertices: Cannot call this method when field coordinates are used "
1625 "without specifying an element block.");
1629template <
typename ArrayT>
1636 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
1637 "STK_Interface::getElementVertices: Cannot call this method when field coordinates are used "
1638 "without specifying an element block.");
1642template <
typename ArrayT>
1653template <
typename ArrayT>
1659 std::vector<stk::mesh::Entity> selected_elements;
1660 for(std::size_t cell=0;cell<localElementIds.size();cell++)
1661 selected_elements.push_back(elements[localElementIds[cell]]);
1671template <
typename ArrayT>
1682 std::vector<stk::mesh::Entity> selected_elements;
1683 for(std::size_t cell=0;cell<localElementIds.size();cell++)
1684 selected_elements.push_back(elements[localElementIds[cell]]);
1689 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
1690 "STK_Interface::getElementVerticesNoResize: Cannot call this method when field coordinates are used "
1691 "without specifying an element block.");
1695template <
typename ArrayT>
1702 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
1703 "STK_Interface::getElementVerticesNoResize: Cannot call this method when field coordinates are used "
1704 "without specifying an element block.");
1708template <
typename ArrayT>
1719template <
typename ArrayT>
1725 std::vector<stk::mesh::Entity> selected_elements;
1726 for(std::size_t cell=0;cell<localElementIds.size();cell++)
1727 selected_elements.push_back(elements[localElementIds[cell]]);
1737template <
typename ArrayT>
1741 if(elements.size() == 0) {
1742 vertices = Kokkos::createDynRankView(vertices,
"vertices", 0, 0, 0);
1751 const auto masterVertexCount
1752 = stk::mesh::get_cell_topology(
bulkData_->bucket(elements[0]).topology()).getCellTopologyData()->vertex_count;
1755 vertices = Kokkos::createDynRankView(vertices,
"vertices", elements.size(), masterVertexCount,
getDimension());
1756 auto vertices_h = Kokkos::create_mirror_view(vertices);
1757 Kokkos::deep_copy(vertices_h, vertices);
1761 for(std::size_t cell = 0; cell < elements.size(); cell++) {
1762 const auto element = elements[cell];
1763 TEUCHOS_ASSERT(element != 0);
1765 const auto vertexCount
1766 = stk::mesh::get_cell_topology(
bulkData_->bucket(element).topology()).getCellTopologyData()->vertex_count;
1767 TEUCHOS_TEST_FOR_EXCEPTION(vertexCount != masterVertexCount, std::runtime_error,
1768 "In call to STK_Interface::getElementVertices all elements "
1769 "must have the same vertex count!");
1772 const size_t num_nodes =
bulkData_->num_nodes(element);
1773 auto const* nodes =
bulkData_->begin_nodes(element);
1774 TEUCHOS_TEST_FOR_EXCEPTION(num_nodes!=masterVertexCount,std::runtime_error,
1775 "In call to STK_Interface::getElementVertices cardinality of "
1776 "element node relations must be the vertex count!");
1777 for(std::size_t node = 0; node < num_nodes; ++node) {
1781 for(
unsigned d=0;d<dim;d++)
1782 vertices_h(cell,node,d) = coord[d];
1785 Kokkos::deep_copy(vertices, vertices_h);
1788template <
typename ArrayT>
1792 if(elements.size()==0) {
1801 unsigned masterVertexCount
1802 = stk::mesh::get_cell_topology(
bulkData_->bucket(elements[0]).topology()).getCellTopologyData()->vertex_count;
1806 auto vertices_h = Kokkos::create_mirror_view(vertices);
1807 for(std::size_t cell=0;cell<elements.size();cell++) {
1808 stk::mesh::Entity element = elements[cell];
1809 TEUCHOS_ASSERT(element!=0);
1811 unsigned vertexCount
1812 = stk::mesh::get_cell_topology(
bulkData_->bucket(element).topology()).getCellTopologyData()->vertex_count;
1813 TEUCHOS_TEST_FOR_EXCEPTION(vertexCount!=masterVertexCount,std::runtime_error,
1814 "In call to STK_Interface::getElementVertices all elements "
1815 "must have the same vertex count!");
1818 const size_t num_nodes =
bulkData_->num_nodes(element);
1819 stk::mesh::Entity
const* nodes =
bulkData_->begin_nodes(element);
1820 TEUCHOS_TEST_FOR_EXCEPTION(num_nodes!=masterVertexCount,std::runtime_error,
1821 "In call to STK_Interface::getElementVertices cardinality of "
1822 "element node relations must be the vertex count!");
1823 for(std::size_t node=0; node<num_nodes; ++node) {
1827 for(
unsigned d=0;d<dim;d++)
1828 vertices_h(cell,node,d) = coord[d];
1831 Kokkos::deep_copy(vertices, vertices_h);
1834template <
typename ArrayT>
1840 if(elements.size()==0) {
1841 vertices = Kokkos::createDynRankView(vertices,
"vertices",0,0,0);
1846 unsigned masterVertexCount
1847 = stk::mesh::get_cell_topology(
bulkData_->bucket(elements[0]).topology()).getCellTopologyData()->vertex_count;
1850 vertices = Kokkos::createDynRankView(vertices,
"vertices",elements.size(),masterVertexCount,
getDimension());
1851 auto vertices_h = Kokkos::create_mirror_view(vertices);
1852 std::map<std::string,std::vector<std::string> >::const_iterator itr =
meshCoordFields_.find(eBlock);
1855 TEUCHOS_ASSERT(
false);
1858 const std::vector<std::string> & coordField = itr->second;
1859 std::vector<SolutionFieldType*> fields(
getDimension());
1860 for(std::size_t d=0;d<fields.size();d++) {
1864 for(std::size_t cell=0;cell<elements.size();cell++) {
1865 stk::mesh::Entity element = elements[cell];
1868 const size_t num_nodes =
bulkData_->num_nodes(element);
1869 stk::mesh::Entity
const* nodes =
bulkData_->begin_nodes(element);
1870 for(std::size_t i=0; i<num_nodes; ++i) {
1871 stk::mesh::Entity node = nodes[i];
1876 double * solnData = stk::mesh::field_data(*fields[d],node);
1880 vertices_h(cell,i,d) = solnData[0]+coord[d];
1884 Kokkos::deep_copy(vertices, vertices_h);
1887template <
typename ArrayT>
1889 const std::string & eBlock, ArrayT & vertices)
const
1894 if(elements.size()==0) {
1898 std::map<std::string,std::vector<std::string> >::const_iterator itr =
meshCoordFields_.find(eBlock);
1901 TEUCHOS_ASSERT(
false);
1904 const std::vector<std::string> & coordField = itr->second;
1905 std::vector<SolutionFieldType*> fields(
getDimension());
1906 for(std::size_t d=0;d<fields.size();d++) {
1910 for(std::size_t cell=0;cell<elements.size();cell++) {
1911 stk::mesh::Entity element = elements[cell];
1914 const size_t num_nodes =
bulkData_->num_nodes(element);
1915 stk::mesh::Entity
const* nodes =
bulkData_->begin_nodes(element);
1916 for(std::size_t i=0; i<num_nodes; ++i) {
1917 stk::mesh::Entity node = nodes[i];
1922 double * solnData = stk::mesh::field_data(*fields[d],node);
1926 vertices(cell,i,d) = solnData[0]+coord[d];
PHX::MDField< ScalarT, panzer::Cell, panzer::BASIS > field
A field to which we'll contribute, or in which we'll store, the result of computing this integral.
virtual ~ElementDescriptor()
const std::vector< stk::mesh::EntityId > & getNodes() const
std::vector< stk::mesh::EntityId > nodes_
stk::mesh::EntityId getGID() const
const STK_Interface * mesh_
bool operator()(stk::mesh::Entity a, stk::mesh::Entity b)
LocalIdCompare(const STK_Interface *mesh)
void rebalance(const Teuchos::ParameterList ¶ms)
void buildLocalElementIDs()
const VectorFieldType & getEdgesField() const
stk::mesh::Entity findConnectivityById(stk::mesh::Entity src, stk::mesh::EntityRank tgt_rank, unsigned rel_id) const
void applyElementLoadBalanceWeights()
Teuchos::RCP< stk::mesh::MetaData > metaData_
VectorFieldType * facesField_
Teuchos::RCP< std::vector< stk::mesh::Entity > > orderedFaceVector_
std::pair< Teuchos::RCP< std::vector< std::pair< std::size_t, std::size_t > > >, Teuchos::RCP< std::vector< unsigned int > > > getPeriodicNodePairing() const
void setFaceFieldData(const std::string &fieldName, const std::string &blockId, const std::vector< std::size_t > &localFaceIds, const ArrayT &faceValues, double scaleValue=1.0)
bool isValid(stk::mesh::Entity entity) const
const std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > & getPeriodicBCVector() const
void initialize(stk::ParallelMachine parallelMach, bool setupIO=true, const bool buildRefinementSupport=false)
stk::mesh::Field< double > SolutionFieldType
void getMyFaces(std::vector< stk::mesh::Entity > &faces) const
stk::mesh::Part * getElementBlockPart(const std::string &name) const
get the block part
static const std::string edgesString
void addGlobalToExodus(const std::string &key, const int &value)
Add an int global variable to the information to be written to the Exodus output file.
double getCurrentStateTime() const
static const std::string edgeBlockString
void getElementVertices(const std::vector< std::size_t > &localIds, ArrayT &vertices) const
void getElementVertices_FromCoords(const std::vector< stk::mesh::Entity > &elements, ArrayT &vertices) const
std::size_t getNumSidesets() const
get the side set count
Teuchos::RCP< std::vector< stk::mesh::Entity > > orderedElementVector_
std::map< std::string, stk::mesh::Part * > sidesets_
void addPeriodicBC(const Teuchos::RCP< const PeriodicBC_MatcherBase > &bc)
stk::mesh::EntityId elementGlobalId(std::size_t lid) const
stk::mesh::Part * getEdgeBlock(const std::string &name) const
get the block part
std::unordered_map< stk::mesh::EntityId, std::size_t > localFaceIDHash_
void getElementsSharingNodes(const std::vector< stk::mesh::EntityId > nodeId, std::vector< stk::mesh::Entity > &elements) const
get a set of elements sharing multiple nodes
std::size_t getEntityCounts(unsigned entityRank) const
get the global counts for the entity of specified rank
void getFaceBlockNames(std::vector< std::string > &names) const
stk::mesh::Field< double, stk::mesh::Cartesian > VectorFieldType
bool isFaceLocal(stk::mesh::Entity face) const
void initializeFromMetaData()
void addEntityToEdgeBlock(stk::mesh::Entity entity, stk::mesh::Part *edgeblock)
Teuchos::RCP< const std::vector< stk::mesh::Entity > > getElementsOrderedByLID() const
bool isInitialized() const
Has initialize been called on this mesh object?
std::map< std::string, stk::mesh::Part * > faceBlocks_
void addEntitiesToFaceBlock(std::vector< stk::mesh::Entity > entities, stk::mesh::Part *faceblock)
stk::mesh::EntityRank getNodeRank() const
void addInformationRecords(const std::vector< std::string > &info_records)
std::string containingBlockId(stk::mesh::Entity elmt) const
void getEdgeBlockNames(std::vector< std::string > &names) const
void addEdgeBlock(const std::string &elemBlockName, const std::string &edgeBlockName, const stk::topology &topology)
void getElementVertices_FromField(const std::vector< stk::mesh::Entity > &elements, const std::string &eBlock, ArrayT &vertices) const
const VectorFieldType & getFacesField() const
std::vector< std::size_t > entityCounts_
void getElementsSharingNode(stk::mesh::EntityId nodeId, std::vector< stk::mesh::Entity > &elements) const
get a set of elements sharing a single node
Teuchos::RCP< const std::vector< stk::mesh::Entity > > getEdgesOrderedByLID() const
void buildSubcells()
force the mesh to build subcells: edges and faces
void setCellFieldData(const std::string &fieldName, const std::string &blockId, const std::vector< std::size_t > &localElementIds, const ArrayT &solutionValues, double scaleValue=1.0)
stk::mesh::EntityId getMaxEntityId(unsigned entityRank) const
get max entity ID of type entityRank
std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > & getPeriodicBCVector()
stk::mesh::EntityRank getElementRank() const
std::size_t currentLocalId_
void getOwnedElementsSharingNode(stk::mesh::Entity node, std::vector< stk::mesh::Entity > &elements, std::vector< int > &relIds) const
const double * getNodeCoordinates(stk::mesh::EntityId nodeId) const
void getNodeIdsForElement(stk::mesh::Entity element, std::vector< stk::mesh::EntityId > &nodeIds) const
get a list of node ids for nodes connected to an element
void setBlockWeight(const std::string &blockId, double weight)
void addEdgeField(const std::string &fieldName, const std::string &blockId)
stk::mesh::EntityId faceGlobalId(stk::mesh::Entity face) const
std::unordered_map< stk::mesh::EntityId, std::size_t > localEdgeIDHash_
void addEntityToFaceBlock(stk::mesh::Entity entity, stk::mesh::Part *faceblock)
void getNeighborElements(std::vector< stk::mesh::Entity > &elements) const
void getMyNodes(const std::string &sideName, const std::string &blockName, std::vector< stk::mesh::Entity > &nodes) const
std::vector< stk::mesh::Part * > edgesPartVec_
bool isModifiable() const
const bool & useBoundingBoxSearch() const
void setEdgeFieldData(const std::string &fieldName, const std::string &blockId, const std::vector< std::size_t > &localEdgeIds, const ArrayT &edgeValues, double scaleValue=1.0)
void addEntityToNodeset(stk::mesh::Entity entity, stk::mesh::Part *nodeset)
void getElementVerticesNoResize(const std::vector< std::size_t > &localIds, ArrayT &vertices) const
void addElement(const Teuchos::RCP< ElementDescriptor > &ed, stk::mesh::Part *block)
bool isEdgeLocal(stk::mesh::Entity edge) const
void addPeriodicBCs(const std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > &bc_vec)
void refineMesh(const int numberOfLevels, const bool deleteParentElements)
stk::mesh::Part * nodesPart_
stk::mesh::Part * facesPart_
std::map< std::string, double > blockWeights_
std::map< std::pair< std::string, std::string >, SolutionFieldType * > fieldNameToEdgeField_
void addNode(stk::mesh::EntityId gid, const std::vector< double > &coord)
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
get the comm associated with this mesh
std::map< std::pair< std::string, std::string >, SolutionFieldType * > fieldNameToFaceField_
void setSolutionFieldData(const std::string &fieldName, const std::string &blockId, const std::vector< std::size_t > &localElementIds, const ArrayT &solutionValues, double scaleValue=1.0)
std::size_t elementLocalId(stk::mesh::Entity elmt) const
void addCellField(const std::string &fieldName, const std::string &blockId)
void setInitialStateTime(double value)
stk::mesh::Field< double > * getSolutionField(const std::string &fieldName, const std::string &blockId) const
std::map< std::pair< std::string, std::string >, SolutionFieldType * > fieldNameToSolution_
void getAllSides(const std::string &sideName, std::vector< stk::mesh::Entity > &sides) const
VectorFieldType * coordinatesField_
stk::mesh::Part * edgesPart_
void getElementVertices_FromFieldNoResize(const std::vector< stk::mesh::Entity > &elements, const std::string &eBlock, ArrayT &vertices) const
void getMySides(const std::string &sideName, std::vector< stk::mesh::Entity > &sides) const
double getInitialStateTime() const
void addMeshCoordFields(const std::string &blockId, const std::vector< std::string > &coordField, const std::string &dispPrefix)
stk::mesh::Field< double > * getEdgeField(const std::string &fieldName, const std::string &blockId) const
std::vector< stk::mesh::EntityId > maxEntityId_
void getElementBlockNames(std::vector< std::string > &names) const
Teuchos::RCP< stk::mesh::BulkData > bulkData_
void addNodeset(const std::string &name)
void getSidesetNames(std::vector< std::string > &name) const
void addSideset(const std::string &name, const CellTopologyData *ctData)
stk::mesh::EntityRank getFaceRank() const
void getMyEdges(std::vector< stk::mesh::Entity > &edges) const
std::size_t getNumNodesets() const
get the side set count
bool getUseFieldCoordinates() const
std::set< std::string > informationRecords_
void getAllEdges(const std::string &edgeBlockName, std::vector< stk::mesh::Entity > &edges) const
std::vector< stk::mesh::Part * > nodesPartVec_
void initializeFieldsInSTK(const std::map< std::pair< std::string, std::string >, SolutionFieldType * > &nameToField, bool setupIO)
static const std::string nodesString
const VectorFieldType & getCoordinatesField() const
void setUseFieldCoordinates(bool useFieldCoordinates)
Teuchos::RCP< stk::mesh::MetaData > getMetaData() const
stk::mesh::Field< double > * getFaceField(const std::string &fieldName, const std::string &blockId) const
static const std::string facesString
void writeToExodus(const std::string &filename, const bool append=false)
Write this mesh and associated fields to the given output file.
unsigned getDimension() const
get the dimension
bool isMeshCoordField(const std::string &eBlock, const std::string &fieldName, int &axis) const
std::map< std::string, stk::mesh::Part * > nodesets_
void getElementVertices_FromCoordsNoResize(const std::vector< stk::mesh::Entity > &elements, ArrayT &vertices) const
SolutionFieldType * loadBalField_
std::map< std::string, std::vector< std::string > > meshCoordFields_
stk::mesh::Field< double > * getCellField(const std::string &fieldName, const std::string &blockId) const
std::size_t faceLocalId(stk::mesh::Entity elmt) const
void getAllFaces(const std::string &faceBlockName, std::vector< stk::mesh::Entity > &faces) const
void setupExodusFile(const std::string &filename, const bool append=false, const bool append_after_restart_time=false, const double restart_time=0.0)
Set up an output Exodus file for writing results.
Teuchos::RCP< std::vector< stk::mesh::Entity > > orderedEdgeVector_
stk::mesh::Part * getNodeset(const std::string &name) const
Teuchos::RCP< const shards::CellTopology > getCellTopology(const std::string &eBlock) const
stk::mesh::EntityId edgeGlobalId(std::size_t lid) const
unsigned entityOwnerRank(stk::mesh::Entity entity) const
void getNodesetNames(std::vector< std::string > &name) const
void addEntitiesToEdgeBlock(std::vector< stk::mesh::Entity > entities, stk::mesh::Part *edgeblock)
stk::mesh::Field< ProcIdData > ProcIdFieldType
bool getUseLowerCaseForIO() const
std::unordered_map< stk::mesh::EntityId, std::size_t > localIDHash_
void addSolutionField(const std::string &fieldName, const std::string &blockId)
VectorFieldType * edgesField_
void getSubcellIndices(unsigned entityRank, stk::mesh::EntityId elementId, std::vector< stk::mesh::EntityId > &subcellIds) const
std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > periodicBCs_
void addEntityToSideset(stk::mesh::Entity entity, stk::mesh::Part *sideset)
Teuchos::RCP< const std::vector< stk::mesh::Entity > > getFacesOrderedByLID() const
void setDispFieldData(const std::string &fieldName, const std::string &blockId, int axis, const std::vector< std::size_t > &localElementIds, const ArrayT &solutionValues)
stk::mesh::EntityId elementGlobalId(stk::mesh::Entity elmt) const
std::map< std::string, Teuchos::RCP< shards::CellTopology > > elementBlockCT_
stk::mesh::EntityRank getSideRank() const
Teuchos::RCP< Teuchos::MpiComm< int > > mpiComm_
ProcIdFieldType * processorIdField_
bool validBlockId(const std::string &blockId) const
stk::mesh::EntityId edgeGlobalId(stk::mesh::Entity edge) const
void addFaceField(const std::string &fieldName, const std::string &blockId)
std::map< std::string, stk::mesh::Part * > edgeBlocks_
void print(std::ostream &os) const
void getMyElements(std::vector< stk::mesh::Entity > &elements) const
stk::mesh::Part * getOwnedPart() const
Get a pointer to the locally owned part.
void addElementBlock(const std::string &name, const CellTopologyData *ctData)
ProcIdFieldType * getProcessorIdField()
void addFaceBlock(const std::string &elemBlockName, const std::string &faceBlockName, const stk::topology &topology)
Teuchos::RCP< stk::mesh::BulkData > getBulkData() const
std::map< std::string, std::vector< std::string > > meshDispFields_
static const std::string faceBlockString
std::vector< stk::mesh::Part * > facesPartVec_
bool useFieldCoordinates_
void printMetaData(std::ostream &os) const
void instantiateBulkData(stk::ParallelMachine parallelMach)
stk::mesh::EntityId faceGlobalId(std::size_t lid) const
std::map< std::pair< std::string, std::string >, SolutionFieldType * > fieldNameToCellField_
std::size_t edgeLocalId(stk::mesh::Entity elmt) const
std::map< std::string, stk::mesh::Part * > elementBlocks_
static const std::string coordsString
void getSolutionFieldData(const std::string &fieldName, const std::string &blockId, const std::vector< std::size_t > &localElementIds, ArrayT &solutionValues) const
void setUseLowerCaseForIO(bool useLowerCase)
Teuchos::RCP< Teuchos::MpiComm< int > > getSafeCommunicator(stk::ParallelMachine parallelMach) const
std::size_t getNumElementBlocks() const
get the block count
void setBoundingBoxSearchFlag(const bool &searchFlag)
stk::mesh::Part * getFaceBlock(const std::string &name) const
get the block part
stk::mesh::EntityRank getEdgeRank() const
stk::mesh::Part * getSideset(const std::string &name) const
Teuchos::RCP< ElementDescriptor > buildElementDescriptor(stk::mesh::EntityId elmtId, std::vector< stk::mesh::EntityId > &nodes)
EdgeBlockException(const std::string &what)
ElementBlockException(const std::string &what)
FaceBlockException(const std::string &what)
SidesetException(const std::string &what)