Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_STK_Interface.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Panzer: A partial differential equation assembly
5 // engine for strongly coupled complex multiphysics systems
6 // Copyright (2011) Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Roger P. Pawlowski (rppawlo@sandia.gov) and
39 // Eric C. Cyr (eccyr@sandia.gov)
40 // ***********************************************************************
41 // @HEADER
42 
43 #ifndef __Panzer_STK_Interface_hpp__
44 #define __Panzer_STK_Interface_hpp__
45 
46 #include <Teuchos_RCP.hpp>
48 
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>
56 
57 #include "Kokkos_Core.hpp"
58 
59 #include <Shards_CellTopology.hpp>
60 #include <Shards_CellTopologyData.h>
61 
62 #include <PanzerAdaptersSTK_config.hpp>
63 #include <Kokkos_ViewFactory.hpp>
64 
65 #include <unordered_map>
66 
67 #ifdef PANZER_HAVE_IOSS
68 #include <stk_io/StkMeshIoBroker.hpp>
69 #endif
70 
71 namespace panzer_stk {
72 
73 class PeriodicBC_MatcherBase;
74 
79 public:
80  ElementDescriptor(stk::mesh::EntityId gid,const std::vector<stk::mesh::EntityId> & nodes);
81  virtual ~ElementDescriptor();
82 
83  stk::mesh::EntityId getGID() const { return gid_; }
84  const std::vector<stk::mesh::EntityId> & getNodes() const { return nodes_; }
85 protected:
86  stk::mesh::EntityId gid_;
87  std::vector<stk::mesh::EntityId> nodes_;
88 
90 };
91 
95 buildElementDescriptor(stk::mesh::EntityId elmtId,std::vector<stk::mesh::EntityId> & nodes);
96 
98 public:
99  typedef double ProcIdData; // ECC: Not sure why?
100  typedef stk::mesh::Field<double> SolutionFieldType;
101  typedef stk::mesh::Field<double,stk::mesh::Cartesian> VectorFieldType;
102  typedef stk::mesh::Field<ProcIdData> ProcIdFieldType;
103 
104  // some simple exception classes
105  struct ElementBlockException : public std::logic_error
106  { ElementBlockException(const std::string & what) : std::logic_error(what) {} };
107 
108  struct SidesetException : public std::logic_error
109  { SidesetException(const std::string & what) : std::logic_error(what) {} };
110 
111  STK_Interface();
112 
115  STK_Interface(unsigned dim);
116 
118 
119  // functions called before initialize
121 
124  void addElementBlock(const std::string & name,const CellTopologyData * ctData);
125 
128  void addSideset(const std::string & name,const CellTopologyData * ctData);
129 
132  void addNodeset(const std::string & name);
133 
136  void addSolutionField(const std::string & fieldName,const std::string & blockId);
137 
140  void addCellField(const std::string & fieldName,const std::string & blockId);
141 
150  void addMeshCoordFields(const std::string & blockId,
151  const std::vector<std::string> & coordField,
152  const std::string & dispPrefix);
153 
155 
163  void initialize(stk::ParallelMachine parallelMach,bool setupIO=true);
164 
170  void instantiateBulkData(stk::ParallelMachine parallelMach);
171 
172  // functions to manage and manipulate bulk data
174 
177  void beginModification();
178 
181  void endModification();
182 
188  void addNode(stk::mesh::EntityId gid, const std::vector<double> & coord);
189 
190  void addElement(const Teuchos::RCP<ElementDescriptor> & ed,stk::mesh::Part * block);
191 
192  void addEdges();
193 
194  void addFaces();
195 
198  void addEntityToSideset(stk::mesh::Entity entity,stk::mesh::Part * sideset);
199 
202  void addEntityToNodeset(stk::mesh::Entity entity,stk::mesh::Part * nodeset);
203 
204  // Methods to interrogate the mesh topology and structure
206 
210  { return *coordinatesField_; }
211 
215  { return *edgesField_; }
216 
218  { return *facesField_; }
219 
222  const double * getNodeCoordinates(stk::mesh::EntityId nodeId) const;
223 
226  const double * getNodeCoordinates(stk::mesh::Entity node) const;
227 
230  void getSubcellIndices(unsigned entityRank,stk::mesh::EntityId elementId,
231  std::vector<stk::mesh::EntityId> & subcellIds) const;
232 
235  void getMyElements(std::vector<stk::mesh::Entity> & elements) const;
236 
239  void getMyElements(const std::string & blockID,std::vector<stk::mesh::Entity> & elements) const;
240 
244  void getNeighborElements(std::vector<stk::mesh::Entity> & elements) const;
245 
248  void getNeighborElements(const std::string & blockID,std::vector<stk::mesh::Entity> & elements) const;
249 
257  void getMySides(const std::string & sideName,std::vector<stk::mesh::Entity> & sides) const;
258 
267  void getMySides(const std::string & sideName,const std::string & blockName,std::vector<stk::mesh::Entity> & sides) const;
268 
276  void getAllSides(const std::string & sideName,std::vector<stk::mesh::Entity> & sides) const;
277 
287  void getAllSides(const std::string & sideName,const std::string & blockName,std::vector<stk::mesh::Entity> & sides) const;
288 
298  void getMyNodes(const std::string & sideName,const std::string & blockName,std::vector<stk::mesh::Entity> & nodes) const;
299 
308  stk::mesh::Entity findConnectivityById(stk::mesh::Entity src, stk::mesh::EntityRank tgt_rank, unsigned rel_id) const;
309 
310  // Utility functions
312 
320  void
322  const std::string& filename);
323 
338  void
340  const std::string& filename);
341 
354  void
356  double timestep);
357 
377  void
379  const std::string& key,
380  const int& value);
381 
401  void
403  const std::string& key,
404  const double& value);
405 
425  void
427  const std::string& key,
428  const std::vector<int>& value);
429 
449  void
451  const std::string& key,
452  const std::vector<double>& value);
453 
454  // Accessor functions
456 
459 
462 
463  bool isWritable() const;
464 
465  bool isModifiable() const
466  { if(bulkData_==Teuchos::null) return false;
467  return bulkData_->in_modifiable_state(); }
468 
470  unsigned getDimension() const
471  { return dimension_; }
472 
474  std::size_t getNumElementBlocks() const
475  { return elementBlocks_.size(); }
476 
484  void getElementBlockNames(std::vector<std::string> & names) const;
485 
493  void getSidesetNames(std::vector<std::string> & name) const;
494 
502  void getNodesetNames(std::vector<std::string> & name) const;
503 
505  stk::mesh::Part * getOwnedPart() const
506  { return &getMetaData()->locally_owned_part(); } // I don't like the pointer access here, but it will do for now!
507 
509  stk::mesh::Part * getElementBlockPart(const std::string & name) const
510  {
511  std::map<std::string, stk::mesh::Part*>::const_iterator itr = elementBlocks_.find(name); // Element blocks
512  if(itr==elementBlocks_.end()) return 0;
513  return itr->second;
514  }
515 
517  std::size_t getNumSidesets() const
518  { return sidesets_.size(); }
519 
520  stk::mesh::Part * getSideset(const std::string & name) const
521  { return sidesets_.find(name)->second; }
522 
524  std::size_t getNumNodesets() const
525  { return nodesets_.size(); }
526 
527  stk::mesh::Part * getNodeset(const std::string & name) const
528  { return nodesets_.find(name)->second; }
529 
531  std::size_t getEntityCounts(unsigned entityRank) const;
532 
534  stk::mesh::EntityId getMaxEntityId(unsigned entityRank) const;
535 
536  // Utilities
538 
540  void getElementsSharingNode(stk::mesh::EntityId nodeId,std::vector<stk::mesh::Entity> & elements) const;
541 
543  void getNodeIdsForElement(stk::mesh::Entity element,std::vector<stk::mesh::EntityId> & nodeIds) const;
544 
547  void getOwnedElementsSharingNode(stk::mesh::Entity node,std::vector<stk::mesh::Entity> & elements,
548  std::vector<int> & relIds) const;
549 
552  void getOwnedElementsSharingNode(stk::mesh::EntityId nodeId,std::vector<stk::mesh::Entity> & elements,
553  std::vector<int> & relIds, unsigned int matchType) const;
554 
555 
557  void getElementsSharingNodes(const std::vector<stk::mesh::EntityId> nodeId,std::vector<stk::mesh::Entity> & elements) const;
558 
560  void buildSubcells();
561 
564  std::size_t elementLocalId(stk::mesh::Entity elmt) const;
565 
568  std::size_t elementLocalId(stk::mesh::EntityId gid) const;
569 
572  inline stk::mesh::EntityId elementGlobalId(std::size_t lid) const
573  { return bulkData_->identifier((*orderedElementVector_)[lid]); }
574 
577  inline stk::mesh::EntityId elementGlobalId(stk::mesh::Entity elmt) const
578  { return bulkData_->identifier(elmt); }
579 
582  inline unsigned entityOwnerRank(stk::mesh::Entity entity) const
583  { return bulkData_->parallel_owner_rank(entity); }
584 
587  inline bool isValid(stk::mesh::Entity entity) const
588  { return bulkData_->is_valid(entity); }
589 
592  std::string containingBlockId(stk::mesh::Entity elmt) const;
593 
598  stk::mesh::Field<double> * getSolutionField(const std::string & fieldName,
599  const std::string & blockId) const;
600 
605  stk::mesh::Field<double> * getCellField(const std::string & fieldName,
606  const std::string & blockId) const;
607 
609 
611  bool isInitialized() const { return initialized_; }
612 
617 
632  template <typename ArrayT>
633  void setSolutionFieldData(const std::string & fieldName,const std::string & blockId,
634  const std::vector<std::size_t> & localElementIds,const ArrayT & solutionValues,double scaleValue=1.0);
635 
650  template <typename ArrayT>
651  void getSolutionFieldData(const std::string & fieldName,const std::string & blockId,
652  const std::vector<std::size_t> & localElementIds,ArrayT & solutionValues) const;
653 
668  template <typename ArrayT>
669  void setCellFieldData(const std::string & fieldName,const std::string & blockId,
670  const std::vector<std::size_t> & localElementIds,const ArrayT & solutionValues,double scaleValue=1.0);
671 
680  template <typename ArrayT>
681  void getElementVertices(const std::vector<std::size_t> & localIds, ArrayT & vertices) const;
682 
691  template <typename ArrayT>
692  void getElementVertices(const std::vector<stk::mesh::Entity> & elements, ArrayT & vertices) const;
693 
703  template <typename ArrayT>
704  void getElementVertices(const std::vector<std::size_t> & localIds,const std::string & eBlock, ArrayT & vertices) const;
705 
715  template <typename ArrayT>
716  void getElementVertices(const std::vector<stk::mesh::Entity> & elements,const std::string & eBlock, ArrayT & vertices) const;
717 
726  template <typename ArrayT>
727  void getElementVerticesNoResize(const std::vector<std::size_t> & localIds, ArrayT & vertices) const;
728 
737  template <typename ArrayT>
738  void getElementVerticesNoResize(const std::vector<stk::mesh::Entity> & elements, ArrayT & vertices) const;
739 
749  template <typename ArrayT>
750  void getElementVerticesNoResize(const std::vector<std::size_t> & localIds,const std::string & eBlock, ArrayT & vertices) const;
751 
761  template <typename ArrayT>
762  void getElementVerticesNoResize(const std::vector<stk::mesh::Entity> & elements,const std::string & eBlock, ArrayT & vertices) const;
763 
764  // const stk::mesh::FEMInterface & getFEMInterface() const
765  // { return *femPtr_; }
766 
767  stk::mesh::EntityRank getElementRank() const { return stk::topology::ELEMENT_RANK; }
768  stk::mesh::EntityRank getSideRank() const { return metaData_->side_rank(); }
769  stk::mesh::EntityRank getFaceRank() const { return stk::topology::FACE_RANK; }
770  stk::mesh::EntityRank getEdgeRank() const { return stk::topology::EDGE_RANK; }
771  stk::mesh::EntityRank getNodeRank() const { return stk::topology::NODE_RANK; }
772 
775  void initializeFromMetaData();
776 
779  void buildLocalElementIDs();
780 
783  const std::vector<Teuchos::RCP<const PeriodicBC_MatcherBase> > &
785  { return periodicBCs_; }
786 
789  std::vector<Teuchos::RCP<const PeriodicBC_MatcherBase> > &
791  { return periodicBCs_; }
792 
799  { periodicBCs_.push_back(bc); }
800 
807  { periodicBCs_.insert(periodicBCs_.end(),bc_vec.begin(),bc_vec.end()); }
808 
809  std::pair<Teuchos::RCP<std::vector<std::pair<std::size_t,std::size_t> > >, Teuchos::RCP<std::vector<unsigned int> > >
810  getPeriodicNodePairing() const;
811 
814  bool validBlockId(const std::string & blockId) const;
815 
818  void print(std::ostream & os) const;
819 
822  void printMetaData(std::ostream & os) const;
823 
826  Teuchos::RCP<const shards::CellTopology> getCellTopology(const std::string & eBlock) const;
827 
832  double getCurrentStateTime() const { return currentStateTime_; }
833 
839  double getInitialStateTime() const { return initialStateTime_; }
840 
845  void setInitialStateTime(double value) { initialStateTime_ = value; }
846 
849  void rebalance(const Teuchos::ParameterList & params);
850 
854  void setBlockWeight(const std::string & blockId,double weight)
855  { blockWeights_[blockId] = weight; }
856 
863  void setUseFieldCoordinates(bool useFieldCoordinates)
864  { useFieldCoordinates_ = useFieldCoordinates; }
865 
868  { return useFieldCoordinates_; }
869 
871  void setUseLowerCaseForIO(bool useLowerCase)
872  { useLowerCase_ = useLowerCase; }
873 
875  bool getUseLowerCaseForIO() const
876  { return useLowerCase_; }
877 
888  template <typename ArrayT>
889  void getElementVertices_FromField(const std::vector<stk::mesh::Entity> & elements,const std::string & eBlock, ArrayT & vertices) const;
890 
891  template <typename ArrayT>
892  void getElementVertices_FromFieldNoResize(const std::vector<stk::mesh::Entity> & elements,
893  const std::string & eBlock, ArrayT & vertices) const;
894 
904  template <typename ArrayT>
905  void getElementVertices_FromCoords(const std::vector<stk::mesh::Entity> & elements, ArrayT & vertices) const;
906 
907  template <typename ArrayT>
908  void getElementVertices_FromCoordsNoResize(const std::vector<stk::mesh::Entity> & elements, ArrayT & vertices) const;
909 
910 public: // static operations
911  static const std::string coordsString;
912  static const std::string nodesString;
913  static const std::string edgesString;
914  static const std::string facesString;
915 
916 protected:
917 
920  void buildEntityCounts();
921 
924  void buildMaxEntityIds();
925 
929  void initializeFieldsInSTK(const std::map<std::pair<std::string,std::string>,SolutionFieldType*> & nameToField,
930  bool setupIO);
931 
936  Teuchos::RCP<Teuchos::MpiComm<int> > getSafeCommunicator(stk::ParallelMachine parallelMach) const;
937 
944 
948  bool isMeshCoordField(const std::string & eBlock,const std::string & fieldName,int & axis) const;
949 
965  template <typename ArrayT>
966  void setDispFieldData(const std::string & fieldName,const std::string & blockId,int axis,
967  const std::vector<std::size_t> & localElementIds,const ArrayT & solutionValues);
968 
969  std::vector<Teuchos::RCP<const PeriodicBC_MatcherBase> > periodicBCs_;
970 
973 
974  std::map<std::string, stk::mesh::Part*> elementBlocks_; // Element blocks
975  std::map<std::string, stk::mesh::Part*> sidesets_; // Side sets
976  std::map<std::string, stk::mesh::Part*> nodesets_; // Node sets
977  std::map<std::string, Teuchos::RCP<shards::CellTopology> > elementBlockCT_;
978 
979  // for storing/accessing nodes
980  stk::mesh::Part * nodesPart_;
981  std::vector<stk::mesh::Part*> nodesPartVec_;
982  stk::mesh::Part * edgesPart_;
983  std::vector<stk::mesh::Part*> edgesPartVec_;
984  stk::mesh::Part * facesPart_;
985  std::vector<stk::mesh::Part*> facesPartVec_;
986 
992 
993  // maps field names to solution field stk mesh handles
994  std::map<std::pair<std::string,std::string>,SolutionFieldType*> fieldNameToSolution_;
995  std::map<std::pair<std::string,std::string>,SolutionFieldType*> fieldNameToCellField_;
996 
997  unsigned dimension_;
998 
1000 
1001  // how many elements, faces, edges, and nodes are there globally
1002  std::vector<std::size_t> entityCounts_;
1003 
1004  // what is maximum entity ID
1005  std::vector<stk::mesh::EntityId> maxEntityId_;
1006 
1007  unsigned procRank_;
1008  std::size_t currentLocalId_;
1009 
1011 
1012  double initialStateTime_; // the time stamp at the time this object was constructed (default 0.0)
1013  double currentStateTime_; // the time stamp set by the user when writeToExodus is called (default 0.0)
1014 
1015 #ifdef PANZER_HAVE_IOSS
1016  // I/O support
1018  int meshIndex_;
1019 
1024  enum class GlobalVariable
1025  {
1026  ADD,
1027  WRITE
1028  }; // end of enum class GlobalVariable
1029 
1046  void
1047  globalToExodus(
1048  const GlobalVariable& flag);
1049 
1053  Teuchos::ParameterList globalData_;
1054 #endif
1055 
1056  // uses lazy evaluation
1058 
1059  // for element block weights
1060  std::map<std::string,double> blockWeights_;
1061 
1062  std::unordered_map<stk::mesh::EntityId,std::size_t> localIDHash_;
1063 
1064  // Store mesh displacement fields by element block. This map
1065  // goes like this meshCoordFields_[eBlock][axis_index] => coordinate FieldName
1066  // goes like this meshDispFields_[eBlock][axis_index] => displacement FieldName
1067  std::map<std::string,std::vector<std::string> > meshCoordFields_; // coordinate fields written by user
1068  std::map<std::string,std::vector<std::string> > meshDispFields_; // displacement fields, output to exodus
1069 
1071 
1073 
1074  // Object describing how to sort a vector of elements using
1075  // local ID as the key, very short lived object
1077  public:
1078  LocalIdCompare(const STK_Interface * mesh) : mesh_(mesh) {}
1079 
1080  // Compares two stk mesh entities based on local ID
1081  bool operator() (stk::mesh::Entity a,stk::mesh::Entity b)
1082  { return mesh_->elementLocalId(a) < mesh_->elementLocalId(b);}
1083 
1084  private:
1086  };
1087 };
1088 
1089 template <typename ArrayT>
1090 void STK_Interface::setSolutionFieldData(const std::string & fieldName,const std::string & blockId,
1091  const std::vector<std::size_t> & localElementIds,const ArrayT & solutionValues,double scaleValue)
1092 {
1093  const std::vector<stk::mesh::Entity> & elements = *(this->getElementsOrderedByLID());
1094 
1095  int field_axis = -1;
1096  if(isMeshCoordField(blockId,fieldName,field_axis)) {
1097  setDispFieldData(fieldName,blockId,field_axis,localElementIds,solutionValues);
1098  return;
1099  }
1100 
1101  SolutionFieldType * field = this->getSolutionField(fieldName,blockId);
1102 
1103  for(std::size_t cell=0;cell<localElementIds.size();cell++) {
1104  std::size_t localId = localElementIds[cell];
1105  stk::mesh::Entity element = elements[localId];
1106 
1107  // loop over nodes set solution values
1108  const size_t num_nodes = bulkData_->num_nodes(element);
1109  stk::mesh::Entity const* nodes = bulkData_->begin_nodes(element);
1110  for(std::size_t i=0; i<num_nodes; ++i) {
1111  stk::mesh::Entity node = nodes[i];
1112 
1113  double * solnData = stk::mesh::field_data(*field,node);
1114  // TEUCHOS_ASSERT(solnData!=0); // only needed if blockId is not specified
1115  solnData[0] = scaleValue*solutionValues(cell,i);
1116  }
1117  }
1118 }
1119 
1120 template <typename ArrayT>
1121 void STK_Interface::setDispFieldData(const std::string & fieldName,const std::string & blockId,int axis,
1122  const std::vector<std::size_t> & localElementIds,const ArrayT & dispValues)
1123 {
1124  TEUCHOS_ASSERT(axis>=0); // sanity check
1125 
1126  const std::vector<stk::mesh::Entity> & elements = *(this->getElementsOrderedByLID());
1127 
1128  SolutionFieldType * field = this->getSolutionField(fieldName,blockId);
1129  const VectorFieldType & coord_field = this->getCoordinatesField();
1130 
1131  for(std::size_t cell=0;cell<localElementIds.size();cell++) {
1132  std::size_t localId = localElementIds[cell];
1133  stk::mesh::Entity element = elements[localId];
1134 
1135  // loop over nodes set solution values
1136  const size_t num_nodes = bulkData_->num_nodes(element);
1137  stk::mesh::Entity const* nodes = bulkData_->begin_nodes(element);
1138  for(std::size_t i=0; i<num_nodes; ++i) {
1139  stk::mesh::Entity node = nodes[i];
1140 
1141  double * solnData = stk::mesh::field_data(*field,node);
1142  double * coordData = stk::mesh::field_data(coord_field,node);
1143  // TEUCHOS_ASSERT(solnData!=0); // only needed if blockId is not specified
1144  solnData[0] = dispValues(cell,i)-coordData[axis];
1145  }
1146  }
1147 }
1148 
1149 template <typename ArrayT>
1150 void STK_Interface::getSolutionFieldData(const std::string & fieldName,const std::string & blockId,
1151  const std::vector<std::size_t> & localElementIds,ArrayT & solutionValues) const
1152 {
1153  const std::vector<stk::mesh::Entity> & elements = *(this->getElementsOrderedByLID());
1154 
1155  solutionValues = Kokkos::createDynRankView(solutionValues,
1156  "solutionValues",
1157  localElementIds.size(),
1158  bulkData_->num_nodes(elements[localElementIds[0]]));
1159 
1160  SolutionFieldType * field = this->getSolutionField(fieldName,blockId);
1161 
1162  for(std::size_t cell=0;cell<localElementIds.size();cell++) {
1163  std::size_t localId = localElementIds[cell];
1164  stk::mesh::Entity element = elements[localId];
1165 
1166  // loop over nodes set solution values
1167  const size_t num_nodes = bulkData_->num_nodes(element);
1168  stk::mesh::Entity const* nodes = bulkData_->begin_nodes(element);
1169  for(std::size_t i=0; i<num_nodes; ++i) {
1170  stk::mesh::Entity node = nodes[i];
1171 
1172  double * solnData = stk::mesh::field_data(*field,node);
1173  // TEUCHOS_ASSERT(solnData!=0); // only needed if blockId is not specified
1174  solutionValues(cell,i) = solnData[0];
1175  }
1176  }
1177 }
1178 
1179 template <typename ArrayT>
1180 void STK_Interface::setCellFieldData(const std::string & fieldName,const std::string & blockId,
1181  const std::vector<std::size_t> & localElementIds,const ArrayT & solutionValues,double scaleValue)
1182 {
1183  const std::vector<stk::mesh::Entity> & elements = *(this->getElementsOrderedByLID());
1184 
1185  SolutionFieldType * field = this->getCellField(fieldName,blockId);
1186 
1187  for(std::size_t cell=0;cell<localElementIds.size();cell++) {
1188  std::size_t localId = localElementIds[cell];
1189  stk::mesh::Entity element = elements[localId];
1190 
1191  double * solnData = stk::mesh::field_data(*field,element);
1192  TEUCHOS_ASSERT(solnData!=0); // only needed if blockId is not specified
1193  solnData[0] = scaleValue*solutionValues(cell,0);
1194  }
1195 }
1196 
1197 template <typename ArrayT>
1198 void STK_Interface::getElementVertices(const std::vector<std::size_t> & localElementIds, ArrayT & vertices) const
1199 {
1200  if(!useFieldCoordinates_) {
1201  //
1202  // gather from the intrinsic mesh coordinates (non-lagrangian)
1203  //
1204 
1205  const std::vector<stk::mesh::Entity> & elements = *(this->getElementsOrderedByLID());
1206 
1207  // convert to a vector of entity objects
1208  std::vector<stk::mesh::Entity> selected_elements;
1209  for(std::size_t cell=0;cell<localElementIds.size();cell++)
1210  selected_elements.push_back(elements[localElementIds[cell]]);
1211 
1212  getElementVertices_FromCoords(selected_elements,vertices);
1213  }
1214  else {
1215  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
1216  "STK_Interface::getElementVertices: Cannot call this method when field coordinates are used "
1217  "without specifying an element block.");
1218  }
1219 }
1220 
1221 template <typename ArrayT>
1222 void STK_Interface::getElementVertices(const std::vector<stk::mesh::Entity> & elements, ArrayT & vertices) const
1223 {
1224  if(!useFieldCoordinates_) {
1225  getElementVertices_FromCoords(elements,vertices);
1226  }
1227  else {
1228  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
1229  "STK_Interface::getElementVertices: Cannot call this method when field coordinates are used "
1230  "without specifying an element block.");
1231  }
1232 }
1233 
1234 template <typename ArrayT>
1235 void STK_Interface::getElementVertices(const std::vector<stk::mesh::Entity> & elements,const std::string & eBlock, ArrayT & vertices) const
1236 {
1237  if(!useFieldCoordinates_) {
1238  getElementVertices_FromCoords(elements,vertices);
1239  }
1240  else {
1241  getElementVertices_FromField(elements,eBlock,vertices);
1242  }
1243 }
1244 
1245 template <typename ArrayT>
1246 void STK_Interface::getElementVertices(const std::vector<std::size_t> & localElementIds,const std::string & eBlock, ArrayT & vertices) const
1247 {
1248  const std::vector<stk::mesh::Entity> & elements = *(this->getElementsOrderedByLID());
1249 
1250  // convert to a vector of entity objects
1251  std::vector<stk::mesh::Entity> selected_elements;
1252  for(std::size_t cell=0;cell<localElementIds.size();cell++)
1253  selected_elements.push_back(elements[localElementIds[cell]]);
1254 
1255  if(!useFieldCoordinates_) {
1256  getElementVertices_FromCoords(selected_elements,vertices);
1257  }
1258  else {
1259  getElementVertices_FromField(selected_elements,eBlock,vertices);
1260  }
1261 }
1262 
1263 template <typename ArrayT>
1264 void STK_Interface::getElementVerticesNoResize(const std::vector<std::size_t> & localElementIds, ArrayT & vertices) const
1265 {
1266  if(!useFieldCoordinates_) {
1267  //
1268  // gather from the intrinsic mesh coordinates (non-lagrangian)
1269  //
1270 
1271  const std::vector<stk::mesh::Entity> & elements = *(this->getElementsOrderedByLID());
1272 
1273  // convert to a vector of entity objects
1274  std::vector<stk::mesh::Entity> selected_elements;
1275  for(std::size_t cell=0;cell<localElementIds.size();cell++)
1276  selected_elements.push_back(elements[localElementIds[cell]]);
1277 
1278  getElementVertices_FromCoordsNoResize(selected_elements,vertices);
1279  }
1280  else {
1281  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
1282  "STK_Interface::getElementVerticesNoResize: Cannot call this method when field coordinates are used "
1283  "without specifying an element block.");
1284  }
1285 }
1286 
1287 template <typename ArrayT>
1288 void STK_Interface::getElementVerticesNoResize(const std::vector<stk::mesh::Entity> & elements, ArrayT & vertices) const
1289 {
1290  if(!useFieldCoordinates_) {
1291  getElementVertices_FromCoordsNoResize(elements,vertices);
1292  }
1293  else {
1294  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
1295  "STK_Interface::getElementVerticesNoResize: Cannot call this method when field coordinates are used "
1296  "without specifying an element block.");
1297  }
1298 }
1299 
1300 template <typename ArrayT>
1301 void STK_Interface::getElementVerticesNoResize(const std::vector<stk::mesh::Entity> & elements,const std::string & eBlock, ArrayT & vertices) const
1302 {
1303  if(!useFieldCoordinates_) {
1304  getElementVertices_FromCoordsNoResize(elements,vertices);
1305  }
1306  else {
1307  getElementVertices_FromFieldNoResize(elements,eBlock,vertices);
1308  }
1309 }
1310 
1311 template <typename ArrayT>
1312 void STK_Interface::getElementVerticesNoResize(const std::vector<std::size_t> & localElementIds,const std::string & eBlock, ArrayT & vertices) const
1313 {
1314  const std::vector<stk::mesh::Entity> & elements = *(this->getElementsOrderedByLID());
1315 
1316  // convert to a vector of entity objects
1317  std::vector<stk::mesh::Entity> selected_elements;
1318  for(std::size_t cell=0;cell<localElementIds.size();cell++)
1319  selected_elements.push_back(elements[localElementIds[cell]]);
1320 
1321  if(!useFieldCoordinates_) {
1322  getElementVertices_FromCoordsNoResize(selected_elements,vertices);
1323  }
1324  else {
1325  getElementVertices_FromFieldNoResize(selected_elements,eBlock,vertices);
1326  }
1327 }
1328 
1329 template <typename ArrayT>
1330 void STK_Interface::getElementVertices_FromCoords(const std::vector<stk::mesh::Entity> & elements, ArrayT & vertices) const
1331 {
1332  // nothing to do! silently return
1333  if(elements.size()==0) {
1334  vertices = Kokkos::createDynRankView(vertices,"vertices",0,0,0);
1335  return;
1336  }
1337 
1338  //
1339  // gather from the intrinsic mesh coordinates (non-lagrangian)
1340  //
1341 
1342  // get *master* cell toplogy...(belongs to first element)
1343  unsigned masterVertexCount
1344  = stk::mesh::get_cell_topology(bulkData_->bucket(elements[0]).topology()).getCellTopologyData()->vertex_count;
1345 
1346  // allocate space
1347  vertices = Kokkos::createDynRankView(vertices,"vertices",elements.size(),masterVertexCount,getDimension());
1348 
1349  // loop over each requested element
1350  unsigned dim = getDimension();
1351  for(std::size_t cell=0;cell<elements.size();cell++) {
1352  stk::mesh::Entity element = elements[cell];
1353  TEUCHOS_ASSERT(element!=0);
1354 
1355  unsigned vertexCount
1356  = stk::mesh::get_cell_topology(bulkData_->bucket(element).topology()).getCellTopologyData()->vertex_count;
1357  TEUCHOS_TEST_FOR_EXCEPTION(vertexCount!=masterVertexCount,std::runtime_error,
1358  "In call to STK_Interface::getElementVertices all elements "
1359  "must have the same vertex count!");
1360 
1361  // loop over all element nodes
1362  const size_t num_nodes = bulkData_->num_nodes(element);
1363  stk::mesh::Entity const* nodes = bulkData_->begin_nodes(element);
1364  TEUCHOS_TEST_FOR_EXCEPTION(num_nodes!=masterVertexCount,std::runtime_error,
1365  "In call to STK_Interface::getElementVertices cardinality of "
1366  "element node relations must be the vertex count!");
1367  for(std::size_t node=0; node<num_nodes; ++node) {
1368  const double * coord = getNodeCoordinates(nodes[node]);
1369 
1370  // set each dimension of the coordinate
1371  for(unsigned d=0;d<dim;d++)
1372  vertices(cell,node,d) = coord[d];
1373  }
1374  }
1375 }
1376 
1377 template <typename ArrayT>
1378 void STK_Interface::getElementVertices_FromCoordsNoResize(const std::vector<stk::mesh::Entity> & elements, ArrayT & vertices) const
1379 {
1380  // nothing to do! silently return
1381  if(elements.size()==0) {
1382  return;
1383  }
1384 
1385  //
1386  // gather from the intrinsic mesh coordinates (non-lagrangian)
1387  //
1388 
1389  // get *master* cell toplogy...(belongs to first element)
1390  unsigned masterVertexCount
1391  = stk::mesh::get_cell_topology(bulkData_->bucket(elements[0]).topology()).getCellTopologyData()->vertex_count;
1392 
1393  // loop over each requested element
1394  unsigned dim = getDimension();
1395  for(std::size_t cell=0;cell<elements.size();cell++) {
1396  stk::mesh::Entity element = elements[cell];
1397  TEUCHOS_ASSERT(element!=0);
1398 
1399  unsigned vertexCount
1400  = stk::mesh::get_cell_topology(bulkData_->bucket(element).topology()).getCellTopologyData()->vertex_count;
1401  TEUCHOS_TEST_FOR_EXCEPTION(vertexCount!=masterVertexCount,std::runtime_error,
1402  "In call to STK_Interface::getElementVertices all elements "
1403  "must have the same vertex count!");
1404 
1405  // loop over all element nodes
1406  const size_t num_nodes = bulkData_->num_nodes(element);
1407  stk::mesh::Entity const* nodes = bulkData_->begin_nodes(element);
1408  TEUCHOS_TEST_FOR_EXCEPTION(num_nodes!=masterVertexCount,std::runtime_error,
1409  "In call to STK_Interface::getElementVertices cardinality of "
1410  "element node relations must be the vertex count!");
1411  for(std::size_t node=0; node<num_nodes; ++node) {
1412  const double * coord = getNodeCoordinates(nodes[node]);
1413 
1414  // set each dimension of the coordinate
1415  for(unsigned d=0;d<dim;d++)
1416  vertices(cell,node,d) = coord[d];
1417  }
1418  }
1419 }
1420 
1421 template <typename ArrayT>
1422 void STK_Interface::getElementVertices_FromField(const std::vector<stk::mesh::Entity> & elements,const std::string & eBlock, ArrayT & vertices) const
1423 {
1425 
1426  // nothing to do! silently return
1427  if(elements.size()==0) {
1428  vertices = Kokkos::createDynRankView(vertices,"vertices",0,0,0);
1429  return;
1430  }
1431 
1432  // get *master* cell toplogy...(belongs to first element)
1433  unsigned masterVertexCount
1434  = stk::mesh::get_cell_topology(bulkData_->bucket(elements[0]).topology()).getCellTopologyData()->vertex_count;
1435 
1436  // allocate space
1437  vertices = Kokkos::createDynRankView(vertices,"vertices",elements.size(),masterVertexCount,getDimension());
1438 
1439  std::map<std::string,std::vector<std::string> >::const_iterator itr = meshCoordFields_.find(eBlock);
1440  if(itr==meshCoordFields_.end()) {
1441  // no coordinate field set for this element block
1442  TEUCHOS_ASSERT(false);
1443  }
1444 
1445  const std::vector<std::string> & coordField = itr->second;
1446  std::vector<SolutionFieldType*> fields(getDimension());
1447  for(std::size_t d=0;d<fields.size();d++) {
1448  fields[d] = this->getSolutionField(coordField[d],eBlock);
1449  }
1450 
1451  for(std::size_t cell=0;cell<elements.size();cell++) {
1452  stk::mesh::Entity element = elements[cell];
1453 
1454  // loop over nodes set solution values
1455  const size_t num_nodes = bulkData_->num_nodes(element);
1456  stk::mesh::Entity const* nodes = bulkData_->begin_nodes(element);
1457  for(std::size_t i=0; i<num_nodes; ++i) {
1458  stk::mesh::Entity node = nodes[i];
1459 
1460  const double * coord = getNodeCoordinates(node);
1461 
1462  for(unsigned d=0;d<getDimension();d++) {
1463  double * solnData = stk::mesh::field_data(*fields[d],node);
1464 
1465  // recall mesh field coordinates are stored as displacements
1466  // from the mesh coordinates, make sure to add them together
1467  vertices(cell,i,d) = solnData[0]+coord[d];
1468  }
1469  }
1470  }
1471 }
1472 
1473 template <typename ArrayT>
1474 void STK_Interface::getElementVertices_FromFieldNoResize(const std::vector<stk::mesh::Entity> & elements,
1475  const std::string & eBlock, ArrayT & vertices) const
1476 {
1478 
1479  // nothing to do! silently return
1480  if(elements.size()==0) {
1481  return;
1482  }
1483 
1484  std::map<std::string,std::vector<std::string> >::const_iterator itr = meshCoordFields_.find(eBlock);
1485  if(itr==meshCoordFields_.end()) {
1486  // no coordinate field set for this element block
1487  TEUCHOS_ASSERT(false);
1488  }
1489 
1490  const std::vector<std::string> & coordField = itr->second;
1491  std::vector<SolutionFieldType*> fields(getDimension());
1492  for(std::size_t d=0;d<fields.size();d++) {
1493  fields[d] = this->getSolutionField(coordField[d],eBlock);
1494  }
1495 
1496  for(std::size_t cell=0;cell<elements.size();cell++) {
1497  stk::mesh::Entity element = elements[cell];
1498 
1499  // loop over nodes set solution values
1500  const size_t num_nodes = bulkData_->num_nodes(element);
1501  stk::mesh::Entity const* nodes = bulkData_->begin_nodes(element);
1502  for(std::size_t i=0; i<num_nodes; ++i) {
1503  stk::mesh::Entity node = nodes[i];
1504 
1505  const double * coord = getNodeCoordinates(node);
1506 
1507  for(unsigned d=0;d<getDimension();d++) {
1508  double * solnData = stk::mesh::field_data(*fields[d],node);
1509 
1510  // recall mesh field coordinates are stored as displacements
1511  // from the mesh coordinates, make sure to add them together
1512  vertices(cell,i,d) = solnData[0]+coord[d];
1513  }
1514  }
1515  }
1516 }
1517 
1518 }
1519 
1520 #endif
Teuchos::RCP< ElementDescriptor > buildElementDescriptor(stk::mesh::EntityId elmtId, std::vector< stk::mesh::EntityId > &nodes)
Teuchos::RCP< Teuchos::MpiComm< int > > getSafeCommunicator(stk::ParallelMachine parallelMach) const
void getSidesetNames(std::vector< std::string > &name) const
std::pair< Teuchos::RCP< std::vector< std::pair< std::size_t, std::size_t > > >, Teuchos::RCP< std::vector< unsigned int > > > getPeriodicNodePairing() const
Kokkos::DynRankView< typename InputArray::value_type, PHX::Device > createDynRankView(const InputArray &a, const std::string &name, const DimensionPack...dims)
Wrapper to simplify Panzer use of Sacado ViewFactory.
void addNodeset(const std::string &name)
Teuchos::RCP< stk::mesh::BulkData > bulkData_
void print(std::ostream &os) const
unsigned entityOwnerRank(stk::mesh::Entity entity) const
Teuchos::RCP< const std::vector< stk::mesh::Entity > > getElementsOrderedByLID() const
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::vector< stk::mesh::Part * > facesPartVec_
std::vector< stk::mesh::EntityId > nodes_
std::map< std::pair< std::string, std::string >, SolutionFieldType * > fieldNameToSolution_
void getElementVerticesNoResize(const std::vector< std::size_t > &localIds, ArrayT &vertices) const
void addEntityToNodeset(stk::mesh::Entity entity, stk::mesh::Part *nodeset)
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.
void setDispFieldData(const std::string &fieldName, const std::string &blockId, int axis, const std::vector< std::size_t > &localElementIds, const ArrayT &solutionValues)
void getElementBlockNames(std::vector< std::string > &names) const
void addPeriodicBC(const Teuchos::RCP< const PeriodicBC_MatcherBase > &bc)
void getSubcellIndices(unsigned entityRank, stk::mesh::EntityId elementId, std::vector< stk::mesh::EntityId > &subcellIds) const
std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > & getPeriodicBCVector()
void getElementsSharingNodes(const std::vector< stk::mesh::EntityId > nodeId, std::vector< stk::mesh::Entity > &elements) const
get a set of elements sharing multiple nodes
stk::mesh::Field< double > SolutionFieldType
stk::mesh::Part * getElementBlockPart(const std::string &name) const
get the block count
std::vector< stk::mesh::Part * > edgesPartVec_
std::map< std::string, double > blockWeights_
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
std::size_t getEntityCounts(unsigned entityRank) const
get the global counts for the entity of specified rank
void printMetaData(std::ostream &os) const
void getElementVertices(const std::vector< std::size_t > &localIds, ArrayT &vertices) const
void addEntityToSideset(stk::mesh::Entity entity, stk::mesh::Part *sideset)
void getElementVertices_FromCoords(const std::vector< stk::mesh::Entity > &elements, ArrayT &vertices) const
void addSolutionField(const std::string &fieldName, const std::string &blockId)
std::map< std::string, Teuchos::RCP< shards::CellTopology > > elementBlockCT_
stk::mesh::EntityId getMaxEntityId(unsigned entityRank) const
get max entity ID of type entityRank
std::map< std::string, stk::mesh::Part * > sidesets_
std::vector< std::size_t > entityCounts_
bool validBlockId(const std::string &blockId) const
stk::mesh::Part * getNodeset(const std::string &name) const
void initialize(stk::ParallelMachine parallelMach, bool setupIO=true)
stk::mesh::Field< double > * getSolutionField(const std::string &fieldName, const std::string &blockId) const
const double * getNodeCoordinates(stk::mesh::EntityId nodeId) const
stk::mesh::Part * getSideset(const std::string &name) const
static const std::string nodesString
void instantiateBulkData(stk::ParallelMachine parallelMach)
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
std::size_t getNumSidesets() const
get the side set count
stk::mesh::EntityId elementGlobalId(stk::mesh::Entity elmt) const
std::size_t elementLocalId(stk::mesh::Entity elmt) const
void getElementVertices_FromCoordsNoResize(const std::vector< stk::mesh::Entity > &elements, ArrayT &vertices) const
unsigned getDimension() const
get the dimension
void addElement(const Teuchos::RCP< ElementDescriptor > &ed, stk::mesh::Part *block)
std::map< std::string, std::vector< std::string > > meshDispFields_
void setUseFieldCoordinates(bool useFieldCoordinates)
stk::mesh::EntityRank getSideRank() const
static const std::string coordsString
stk::mesh::Field< double, stk::mesh::Cartesian > VectorFieldType
std::size_t getNumElementBlocks() const
get the block count
Teuchos::RCP< stk::mesh::BulkData > getBulkData() const
void getElementVertices_FromField(const std::vector< stk::mesh::Entity > &elements, const std::string &eBlock, ArrayT &vertices) const
void writeToExodus(const std::string &filename)
Write this mesh and associated fields to the given output file.
stk::mesh::EntityId elementGlobalId(std::size_t lid) const
std::map< std::string, stk::mesh::Part * > elementBlocks_
std::vector< stk::mesh::Part * > nodesPartVec_
static const std::string edgesString
std::string containingBlockId(stk::mesh::Entity elmt) const
stk::mesh::EntityRank getFaceRank() const
std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > periodicBCs_
void getOwnedElementsSharingNode(stk::mesh::Entity node, std::vector< stk::mesh::Entity > &elements, std::vector< int > &relIds) const
void addNode(stk::mesh::EntityId gid, const std::vector< double > &coord)
void setBlockWeight(const std::string &blockId, double weight)
void buildSubcells()
force the mesh to build subcells: edges and faces
Teuchos::RCP< Teuchos::MpiComm< int > > mpiComm_
void setInitialStateTime(double value)
Teuchos::RCP< stk::mesh::MetaData > metaData_
Teuchos::RCP< stk::mesh::MetaData > getMetaData() const
Teuchos::RCP< std::vector< stk::mesh::Entity > > orderedElementVector_
std::size_t getNumNodesets() const
get the side set count
bool isInitialized() const
Has initialize been called on this mesh object?
void getMyNodes(const std::string &sideName, const std::string &blockName, std::vector< stk::mesh::Entity > &nodes) const
void getSolutionFieldData(const std::string &fieldName, const std::string &blockId, const std::vector< std::size_t > &localElementIds, ArrayT &solutionValues) const
void addMeshCoordFields(const std::string &blockId, const std::vector< std::string > &coordField, const std::string &dispPrefix)
stk::mesh::Entity findConnectivityById(stk::mesh::Entity src, stk::mesh::EntityRank tgt_rank, unsigned rel_id) const
void setUseLowerCaseForIO(bool useLowerCase)
bool isMeshCoordField(const std::string &eBlock, const std::string &fieldName, int &axis) const
void getAllSides(const std::string &sideName, std::vector< stk::mesh::Entity > &sides) const
void addSideset(const std::string &name, const CellTopologyData *ctData)
void setCellFieldData(const std::string &fieldName, const std::string &blockId, const std::vector< std::size_t > &localElementIds, const ArrayT &solutionValues, double scaleValue=1.0)
const VectorFieldType & getEdgesField() const
ProcIdFieldType * getProcessorIdField()
PHX::MDField< ScalarT, panzer::Cell, panzer::BASIS > field
A field to which we&#39;ll contribute, or in which we&#39;ll store, the result of computing this integral...
void rebalance(const Teuchos::ParameterList &params)
std::map< std::string, std::vector< std::string > > meshCoordFields_
stk::mesh::EntityRank getEdgeRank() const
static const std::string facesString
void initializeFieldsInSTK(const std::map< std::pair< std::string, std::string >, SolutionFieldType * > &nameToField, bool setupIO)
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
get the comm associated with this mesh
const std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > & getPeriodicBCVector() const
const VectorFieldType & getFacesField() const
void setupExodusFile(const std::string &filename)
Set up an output Exodus file for writing results.
std::unordered_map< stk::mesh::EntityId, std::size_t > localIDHash_
bool isValid(stk::mesh::Entity entity) const
std::vector< stk::mesh::EntityId > maxEntityId_
stk::mesh::Field< ProcIdData > ProcIdFieldType
void addPeriodicBCs(const std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > &bc_vec)
void getElementsSharingNode(stk::mesh::EntityId nodeId, std::vector< stk::mesh::Entity > &elements) const
get a set of elements sharing a single node
#define TEUCHOS_ASSERT(assertion_test)
void getMyElements(std::vector< stk::mesh::Entity > &elements) const
stk::mesh::EntityRank getNodeRank() const
void addCellField(const std::string &fieldName, const std::string &blockId)
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
bool operator()(stk::mesh::Entity a, stk::mesh::Entity b)
stk::mesh::EntityRank getElementRank() const
void addElementBlock(const std::string &name, const CellTopologyData *ctData)
const std::vector< stk::mesh::EntityId > & getNodes() const
stk::mesh::Field< double > * getCellField(const std::string &fieldName, const std::string &blockId) const
const VectorFieldType & getCoordinatesField() const
stk::mesh::Part * getOwnedPart() const
Get a pointer to the locally owned part.
stk::mesh::EntityId getGID() const
void getNeighborElements(std::vector< stk::mesh::Entity > &elements) const
void getNodesetNames(std::vector< std::string > &name) const
Teuchos::RCP< const shards::CellTopology > getCellTopology(const std::string &eBlock) const
std::map< std::pair< std::string, std::string >, SolutionFieldType * > fieldNameToCellField_
std::map< std::string, stk::mesh::Part * > nodesets_