Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_STK_SquareQuadMeshFactory.cpp
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 
44 #include <Teuchos_TimeMonitor.hpp>
45 #include <PanzerAdaptersSTK_config.hpp>
46 #include "Teuchos_StandardParameterEntryValidators.hpp" // for plist validation
47 
48 // #define ENABLE_UNIFORM
49 
50 using Teuchos::RCP;
51 using Teuchos::rcp;
52 
53 namespace panzer_stk {
54 
56 {
58 }
59 
62 {
63 }
64 
66 Teuchos::RCP<STK_Interface> SquareQuadMeshFactory::buildMesh(stk::ParallelMachine parallelMach) const
67 {
68  PANZER_FUNC_TIME_MONITOR("panzer::SquareQuadMeshFactory::buildMesh()");
69 
70  // build all meta data
71  RCP<STK_Interface> mesh = buildUncommitedMesh(parallelMach);
72 
73  // commit meta data
74  mesh->initialize(parallelMach);
75 
76  // build bulk data
77  completeMeshConstruction(*mesh,parallelMach);
78 
79  return mesh;
80 }
81 
83 {
84  PANZER_FUNC_TIME_MONITOR("panzer::SquareQuadMeshFactory::buildUncomittedMesh()");
85 
86  RCP<STK_Interface> mesh = rcp(new STK_Interface(2));
87 
88  machRank_ = stk::parallel_machine_rank(parallelMach);
89  machSize_ = stk::parallel_machine_size(parallelMach);
90 
91  if (xProcs_ == -1 && yProcs_ == -1) {
92  // copied from galeri
93  xProcs_ = yProcs_ = Teuchos::as<int>(pow(Teuchos::as<double>(machSize_), 0.5));
94 
95  if (xProcs_ * yProcs_ != Teuchos::as<int>(machSize_)) {
96  // Simple method to find a set of processor assignments
97  xProcs_ = yProcs_ = 1;
98 
99  // This means that this works correctly up to about maxFactor^2
100  // processors.
101  const int maxFactor = 100;
102 
103  int ProcTemp = machSize_;
104  int factors[maxFactor];
105  for (int jj = 0; jj < maxFactor; jj++) factors[jj] = 0;
106  for (int jj = 2; jj < maxFactor; jj++) {
107  bool flag = true;
108  while (flag) {
109  int temp = ProcTemp/jj;
110  if (temp*jj == ProcTemp) {
111  factors[jj]++;
112  ProcTemp = temp;
113 
114  } else {
115  flag = false;
116  }
117  }
118  }
119  xProcs_ = ProcTemp;
120  for (int jj = maxFactor-1; jj > 0; jj--) {
121  while (factors[jj] != 0) {
122  if (xProcs_ <= yProcs_) xProcs_ = xProcs_*jj;
123  else yProcs_ = yProcs_*jj;
124  factors[jj]--;
125  }
126  }
127  }
128 
129  } else if(xProcs_==-1) {
130  // default x only decomposition
131  xProcs_ = machSize_;
132  yProcs_ = 1;
133  }
134  TEUCHOS_TEST_FOR_EXCEPTION(int(machSize_) != xProcs_ * yProcs_, std::logic_error,
135  "Cannot build SquareQuadMeshFactory. The product of 'X Procs * Y Procs = " << xProcs_ << "*" << yProcs_ << " = " << xProcs_*yProcs_
136  << "' must equal the number of processors = " << machSize_
137  << "\n\n\t==> Run the simulation with an appropriate number of processors, i.e. #procs = " << xProcs_*yProcs_ << ".\n");
139 
140  // build meta information: blocks and side set setups
141  buildMetaData(parallelMach,*mesh);
142 
143  mesh->addPeriodicBCs(periodicBCVec_);
144  mesh->setBoundingBoxSearchFlag(useBBoxSearch_);
145 
146  return mesh;
147 }
148 
149 void SquareQuadMeshFactory::completeMeshConstruction(STK_Interface & mesh,stk::ParallelMachine parallelMach) const
150 {
151  PANZER_FUNC_TIME_MONITOR("panzer::SquareQuadMeshFactory::completeMeshConstruction()");
152 
153  if(not mesh.isInitialized())
154  mesh.initialize(parallelMach);
155 
156  // add node and element information
157  buildElements(parallelMach,mesh);
158 
159  // finish up the edges
160 #ifndef ENABLE_UNIFORM
161  mesh.buildSubcells();
162 #endif
163  mesh.buildLocalElementIDs();
164  if(createEdgeBlocks_) {
165  mesh.buildLocalEdgeIDs();
166  }
167 
168  // now that edges are built, sidsets can be added
169 #ifndef ENABLE_UNIFORM
170  addSideSets(mesh);
171 #endif
172 
173  // add nodesets
174  addNodeSets(mesh);
175 
176  if(createEdgeBlocks_) {
177  addEdgeBlocks(mesh);
178  }
179 
180  // calls Stk_MeshFactory::rebalance
181  this->rebalance(mesh);
182 }
183 
186 {
188 
189  setMyParamList(paramList);
190 
191  x0_ = paramList->get<double>("X0");
192  y0_ = paramList->get<double>("Y0");
193 
194  xf_ = paramList->get<double>("Xf");
195  yf_ = paramList->get<double>("Yf");
196 
197  xBlocks_ = paramList->get<int>("X Blocks");
198  yBlocks_ = paramList->get<int>("Y Blocks");
199 
200  nXElems_ = paramList->get<int>("X Elements");
201  nYElems_ = paramList->get<int>("Y Elements");
202 
203  xProcs_ = paramList->get<int>("X Procs");
204  yProcs_ = paramList->get<int>("Y Procs");
205 
206  offsetGIDs_ = (paramList->get<std::string>("Offset mesh GIDs above 32-bit int limit") == "ON") ? true : false;
207 
208  createEdgeBlocks_ = paramList->get<bool>("Create Edge Blocks");
209 
210  // read in periodic boundary conditions
211  parsePeriodicBCList(Teuchos::rcpFromRef(paramList->sublist("Periodic BCs")),periodicBCVec_,useBBoxSearch_);
212 }
213 
216 {
217  static RCP<Teuchos::ParameterList> defaultParams;
218 
219  // fill with default values
220  if(defaultParams == Teuchos::null) {
221  defaultParams = rcp(new Teuchos::ParameterList);
222 
223  defaultParams->set<double>("X0",0.0);
224  defaultParams->set<double>("Y0",0.0);
225 
226  defaultParams->set<double>("Xf",1.0);
227  defaultParams->set<double>("Yf",1.0);
228 
229  defaultParams->set<int>("X Blocks",1);
230  defaultParams->set<int>("Y Blocks",1);
231 
232  defaultParams->set<int>("X Procs",-1);
233  defaultParams->set<int>("Y Procs",1);
234 
235  defaultParams->set<int>("X Elements",5);
236  defaultParams->set<int>("Y Elements",5);
237 
238  // default to false for backward compatibility
239  defaultParams->set<bool>("Create Edge Blocks",false,"Create edge blocks in the mesh");
240 
241  defaultParams->set<std::string>("Offset mesh GIDs above 32-bit int limit", "OFF",
242  "If 64-bit GIDs are supported, the mesh element and node global indices will start at a value greater than 32-bit limit.",
243  rcp(new Teuchos::StringValidator(Teuchos::tuple<std::string>("OFF", "ON"))));
244 
245  Teuchos::ParameterList & bcs = defaultParams->sublist("Periodic BCs");
246  bcs.set<int>("Count",0); // no default periodic boundary conditions
247  }
248 
249  return defaultParams;
250 }
251 
253 {
254  // get valid parameters
256 
257  // set that parameter list
258  setParameterList(validParams);
259 
260  /* This is a quad mesh factory so all elements in all element blocks
261  * will be quad4. This means that all the edges will be line2.
262  * The edge block name is hard coded to reflect this.
263  */
265 }
266 
267 void SquareQuadMeshFactory::buildMetaData(stk::ParallelMachine /* parallelMach */, STK_Interface & mesh) const
268 {
269  typedef shards::Quadrilateral<4> QuadTopo;
270  const CellTopologyData * ctd = shards::getCellTopologyData<QuadTopo>();
271  const CellTopologyData * side_ctd = shards::CellTopology(ctd).getBaseCellTopologyData(1,0);
272  const CellTopologyData * edge_ctd = shards::CellTopology(ctd).getBaseCellTopologyData(1,0);
273 
274  // build meta data
275  //mesh.setDimension(2);
276  for(int bx=0;bx<xBlocks_;bx++) {
277  for(int by=0;by<yBlocks_;by++) {
278 
279  // add this element block
280  {
281  std::stringstream ebPostfix;
282  ebPostfix << "-" << bx << "_" << by;
283 
284  // add element blocks
285  mesh.addElementBlock("eblock"+ebPostfix.str(),ctd);
286  if(createEdgeBlocks_) {
287  mesh.addEdgeBlock("eblock"+ebPostfix.str(),
289  edge_ctd);
290  }
291  }
292 
293  }
294  }
295 
296  // add sidesets
297 #ifndef ENABLE_UNIFORM
298  mesh.addSideset("left",side_ctd);
299  mesh.addSideset("right",side_ctd);
300  mesh.addSideset("top",side_ctd);
301  mesh.addSideset("bottom",side_ctd);
302 
303  for(int bx=1;bx<xBlocks_;bx++) {
304  std::stringstream ss;
305  ss << "vertical_" << bx-1;
306  mesh.addSideset(ss.str(),side_ctd);
307  }
308  for(int by=1;by<yBlocks_;by++) {
309  std::stringstream ss;
310  ss << "horizontal_" << by-1;
311  mesh.addSideset(ss.str(),side_ctd);
312  }
313 #endif
314 
315  // add nodesets
316  mesh.addNodeset("lower_left");
317  mesh.addNodeset("origin");
318 }
319 
320 void SquareQuadMeshFactory::buildElements(stk::ParallelMachine parallelMach,STK_Interface & mesh) const
321 {
322  mesh.beginModification();
323  // build each block
324  for(int xBlock=0;xBlock<xBlocks_;xBlock++) {
325  for(int yBlock=0;yBlock<yBlocks_;yBlock++) {
326  buildBlock(parallelMach,xBlock,yBlock,mesh);
327  }
328  }
329  mesh.endModification();
330 }
331 
332 void SquareQuadMeshFactory::buildBlock(stk::ParallelMachine /* parallelMach */,int xBlock,int yBlock,STK_Interface & mesh) const
333 {
334  // grab this processors rank and machine size
335  std::pair<int,int> sizeAndStartX = determineXElemSizeAndStart(xBlock,xProcs_,machRank_);
336  std::pair<int,int> sizeAndStartY = determineYElemSizeAndStart(yBlock,yProcs_,machRank_);
337 
338  int myXElems_start = sizeAndStartX.first;
339  int myXElems_end = myXElems_start+sizeAndStartX.second;
340  int myYElems_start = sizeAndStartY.first;
341  int myYElems_end = myYElems_start+sizeAndStartY.second;
342  int totalXElems = nXElems_*xBlocks_;
343  int totalYElems = nYElems_*yBlocks_;
344 
345  double deltaX = (xf_-x0_)/double(totalXElems);
346  double deltaY = (yf_-y0_)/double(totalYElems);
347 
348  std::vector<double> coord(2,0.0);
349 
350  offset_ = 0;
351  if (offsetGIDs_) {
352  if (std::numeric_limits<panzer::GlobalOrdinal>::max() > std::numeric_limits<unsigned int>::max())
353  offset_ = panzer::GlobalOrdinal(std::numeric_limits<unsigned int>::max()) + 1;
354  }
355 
356  // build the nodes
357  for(int nx=myXElems_start;nx<myXElems_end+1;++nx) {
358  coord[0] = this->getMeshCoord(nx, deltaX, x0_);
359  for(int ny=myYElems_start;ny<myYElems_end+1;++ny) {
360  coord[1] = this->getMeshCoord(ny, deltaY, y0_);
361 
362  mesh.addNode(ny*(totalXElems+1)+nx+1+offset_,coord);
363  }
364  }
365 
366  std::stringstream blockName;
367  blockName << "eblock-" << xBlock << "_" << yBlock;
368  stk::mesh::Part * block = mesh.getElementBlockPart(blockName.str());
369 
370  // build the elements
371  for(int nx=myXElems_start;nx<myXElems_end;++nx) {
372  for(int ny=myYElems_start;ny<myYElems_end;++ny) {
373  stk::mesh::EntityId gid = totalXElems*ny+nx+1 + offset_;
374  std::vector<stk::mesh::EntityId> nodes(4);
375  nodes[0] = nx+1+ny*(totalXElems+1);
376  nodes[1] = nodes[0]+1;
377  nodes[2] = nodes[1]+(totalXElems+1);
378  nodes[3] = nodes[2]-1;
379 
380  for (int i=0; i < 4; ++i)
381  nodes[i] += offset_;
382 
383  RCP<ElementDescriptor> ed = rcp(new ElementDescriptor(gid,nodes));
384  mesh.addElement(ed,block);
385  }
386  }
387 }
388 
389 std::pair<int,int> SquareQuadMeshFactory::determineXElemSizeAndStart(int xBlock,unsigned int size,unsigned int /* rank */) const
390 {
391  std::size_t xProcLoc = procTuple_[0];
392  unsigned int minElements = nXElems_/size;
393  unsigned int extra = nXElems_ - minElements*size;
394 
395  TEUCHOS_ASSERT(minElements>0);
396 
397  // first "extra" elements get an extra column of elements
398  // this determines the starting X index and number of elements
399  int nume=0, start=0;
400  if(xProcLoc<extra) {
401  nume = minElements+1;
402  start = xProcLoc*(minElements+1);
403  }
404  else {
405  nume = minElements;
406  start = extra*(minElements+1)+(xProcLoc-extra)*minElements;
407  }
408 
409  return std::make_pair(start+nXElems_*xBlock,nume);
410 }
411 
412 std::pair<int,int> SquareQuadMeshFactory::determineYElemSizeAndStart(int yBlock,unsigned int size,unsigned int /* rank */) const
413 {
414  std::size_t yProcLoc = procTuple_[1];
415  unsigned int minElements = nYElems_/size;
416  unsigned int extra = nYElems_ - minElements*size;
417 
418  TEUCHOS_ASSERT(minElements>0);
419 
420  // first "extra" elements get an extra column of elements
421  // this determines the starting X index and number of elements
422  int nume=0, start=0;
423  if(yProcLoc<extra) {
424  nume = minElements+1;
425  start = yProcLoc*(minElements+1);
426  }
427  else {
428  nume = minElements;
429  start = extra*(minElements+1)+(yProcLoc-extra)*minElements;
430  }
431 
432  return std::make_pair(start+nYElems_*yBlock,nume);
433 }
434 
436 {
437  mesh.beginModification();
438 
439  std::size_t totalXElems = nXElems_*xBlocks_;
440  std::size_t totalYElems = nYElems_*yBlocks_;
441 
442  // get all part vectors
443  stk::mesh::Part * left = mesh.getSideset("left");
444  stk::mesh::Part * right = mesh.getSideset("right");
445  stk::mesh::Part * top = mesh.getSideset("top");
446  stk::mesh::Part * bottom = mesh.getSideset("bottom");
447 
448  std::vector<stk::mesh::Part*> vertical;
449  std::vector<stk::mesh::Part*> horizontal;
450  for(int bx=1;bx<xBlocks_;bx++) {
451  std::stringstream ss;
452  ss << "vertical_" << bx-1;
453  vertical.push_back(mesh.getSideset(ss.str()));
454  }
455  for(int by=1;by<yBlocks_;by++) {
456  std::stringstream ss;
457  ss << "horizontal_" << by-1;
458  horizontal.push_back(mesh.getSideset(ss.str()));
459  }
460 
461  std::vector<stk::mesh::Entity> localElmts;
462  mesh.getMyElements(localElmts);
463 
464  // loop over elements adding edges to sidesets
465  std::vector<stk::mesh::Entity>::const_iterator itr;
466  for(itr=localElmts.begin();itr!=localElmts.end();++itr) {
467  stk::mesh::Entity element = (*itr);
468  stk::mesh::EntityId gid = mesh.elementGlobalId(element);
469 
470  // reverse the offset for local gid numbering scheme
471  gid -= offset_;
472 
473  std::size_t nx,ny;
474  ny = (gid-1) / totalXElems;
475  nx = gid-ny*totalXElems-1;
476 
477  // vertical boundaries
479 
480  if(nx+1==totalXElems) {
481  stk::mesh::Entity edge = mesh.findConnectivityById(element, stk::topology::EDGE_RANK, 1);
482 
483  // on the right
484  if(mesh.entityOwnerRank(edge)==machRank_)
485  mesh.addEntityToSideset(edge,right);
486  }
487 
488  if(nx==0) {
489  stk::mesh::Entity edge = mesh.findConnectivityById(element, stk::topology::EDGE_RANK, 3);
490 
491  // on the left
492  if(mesh.entityOwnerRank(edge)==machRank_)
493  mesh.addEntityToSideset(edge,left);
494  }
495 
496  if(nx+1!=totalXElems && ((nx+1) % nXElems_==0)) {
497  stk::mesh::Entity edge = mesh.findConnectivityById(element, stk::topology::EDGE_RANK, 1);
498 
499  // on the right
500  if(mesh.entityOwnerRank(edge)==machRank_) {
501  int index = (nx+1)/nXElems_-1;
502  mesh.addEntityToSideset(edge,vertical[index]);
503  }
504  }
505 
506  if(nx!=0 && (nx % nXElems_==0)) {
507  stk::mesh::Entity edge = mesh.findConnectivityById(element, stk::topology::EDGE_RANK, 3);
508 
509  // on the left
510  if(mesh.entityOwnerRank(edge)==machRank_) {
511  int index = nx/nXElems_-1;
512  mesh.addEntityToSideset(edge,vertical[index]);
513  }
514  }
515 
516  // horizontal boundaries
518 
519  if(ny==0) {
520  stk::mesh::Entity edge = mesh.findConnectivityById(element, stk::topology::EDGE_RANK, 0);
521 
522  // on the bottom
523  if(mesh.entityOwnerRank(edge)==machRank_)
524  mesh.addEntityToSideset(edge,bottom);
525  }
526 
527  if(ny+1==totalYElems) {
528  stk::mesh::Entity edge = mesh.findConnectivityById(element, stk::topology::EDGE_RANK, 2);
529 
530  // on the top
531  if(mesh.entityOwnerRank(edge)==machRank_)
532  mesh.addEntityToSideset(edge,top);
533  }
534 
535  if(ny!=0 && (ny % nYElems_==0)) {
536  stk::mesh::Entity edge = mesh.findConnectivityById(element, stk::topology::EDGE_RANK, 0);
537 
538  // on the bottom
539  if(mesh.entityOwnerRank(edge)==machRank_) {
540  int index = ny/nYElems_-1;
541  mesh.addEntityToSideset(edge,horizontal[index]);
542  }
543  }
544 
545  if(ny+1!=totalYElems && ((ny+1) % nYElems_==0)) {
546  stk::mesh::Entity edge = mesh.findConnectivityById(element, stk::topology::EDGE_RANK, 2);
547 
548  // on the top
549  if(mesh.entityOwnerRank(edge)==machRank_) {
550  int index = (ny+1)/nYElems_-1;
551  mesh.addEntityToSideset(edge,horizontal[index]);
552  }
553  }
554  }
555 
556  mesh.endModification();
557 }
558 
560 {
561  mesh.beginModification();
562 
563  // get all part vectors
564  stk::mesh::Part * lower_left = mesh.getNodeset("lower_left");
565  stk::mesh::Part * origin = mesh.getNodeset("origin");
566 
567  // std::vector<stk::mesh::Entity> localElmts;
568  // mesh.getMyElements(localElmts);
569 
571  if(machRank_==0)
572  {
573  // add zero node to lower_left node set
574  stk::mesh::Entity node = bulkData->get_entity(mesh.getNodeRank(),1 + offset_);
575  mesh.addEntityToNodeset(node,lower_left);
576 
577  // add zero node to origin node set
578  mesh.addEntityToNodeset(node,origin);
579  }
580 
581  mesh.endModification();
582 }
583 
585 {
586  mesh.beginModification();
587 
590 
591  stk::mesh::Part * edge_block = mesh.getEdgeBlock(edgeBlockName_);
592 
593  stk::mesh::Selector owned_block = metaData->locally_owned_part();
594 
595  std::vector<stk::mesh::Entity> edges;
596  bulkData->get_entities(mesh.getEdgeRank(), owned_block, edges);
597  mesh.addEntitiesToEdgeBlock(edges, edge_block);
598 
599  mesh.endModification();
600 }
601 
604 {
605  std::size_t i=0,j=0;
606 
607  j = procRank/xProcs_;
608  procRank = procRank % xProcs_;
609  i = procRank;
610 
611  return Teuchos::tuple(i,j);
612 }
613 
614 } // end panzer_stk
void addNodeset(const std::string &name)
unsigned entityOwnerRank(stk::mesh::Entity entity) const
virtual Teuchos::RCP< STK_Interface > buildUncommitedMesh(stk::ParallelMachine parallelMach) const
void addEntityToNodeset(stk::mesh::Entity entity, stk::mesh::Part *nodeset)
static void parsePeriodicBCList(const Teuchos::RCP< Teuchos::ParameterList > &pl, std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > &periodicBC, bool &useBBoxSearch)
T & get(const std::string &name, T def_value)
stk::mesh::Part * getElementBlockPart(const std::string &name) const
get the block part
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
std::pair< int, int > determineXElemSizeAndStart(int xBlock, unsigned int size, unsigned int rank) const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void addEntityToSideset(stk::mesh::Entity entity, stk::mesh::Part *sideset)
void buildElements(stk::ParallelMachine parallelMach, STK_Interface &mesh) const
stk::mesh::Part * getNodeset(const std::string &name) const
void addEdgeBlock(const std::string &elemBlockName, const std::string &edgeBlockName, const stk::topology &topology)
stk::mesh::Part * getSideset(const std::string &name) const
bool offsetGIDs_
If true, offset mesh GIDs to exercise 32-bit limits.
std::pair< int, int > determineYElemSizeAndStart(int yBlock, unsigned int size, unsigned int rank) const
void addElement(const Teuchos::RCP< ElementDescriptor > &ed, stk::mesh::Part *block)
Teuchos::RCP< STK_Interface > buildMesh(stk::ParallelMachine parallelMach) const
Build the mesh object.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void initialize(stk::ParallelMachine parallelMach, bool setupIO=true, const bool buildRefinementSupport=false)
SquareQuadMeshFactory(bool enableRebalance=false)
Constructor.
void rebalance(STK_Interface &mesh) const
Teuchos::RCP< stk::mesh::BulkData > getBulkData() const
stk::mesh::EntityId elementGlobalId(std::size_t lid) const
void setMyParamList(const RCP< ParameterList > &paramList)
void validateParametersAndSetDefaults(ParameterList const &validParamList, int const depth=1000)
static const std::string edgeBlockString
void buildBlock(stk::ParallelMachine machRank, int xBlock, int yBlock, STK_Interface &mesh) const
Teuchos::Tuple< std::size_t, 2 > procRankToProcTuple(std::size_t procRank) const
what is the 2D tuple describe this processor distribution
void addNode(stk::mesh::EntityId gid, const std::vector< double > &coord)
void addEntitiesToEdgeBlock(std::vector< stk::mesh::Entity > entities, stk::mesh::Part *edgeblock)
void buildSubcells()
force the mesh to build subcells: edges and faces
Teuchos::RCP< stk::mesh::MetaData > getMetaData() const
bool isInitialized() const
Has initialize been called on this mesh object?
stk::mesh::Entity findConnectivityById(stk::mesh::Entity src, stk::mesh::EntityRank tgt_rank, unsigned rel_id) const
void addSideset(const std::string &name, const CellTopologyData *ctData)
double getMeshCoord(const int nx, const double deltaX, const double x0) const
stk::mesh::Part * getEdgeBlock(const std::string &name) const
get the block part
void buildMetaData(stk::ParallelMachine parallelMach, STK_Interface &mesh) const
std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > periodicBCVec_
stk::mesh::EntityRank getEdgeRank() const
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &paramList)
From ParameterListAcceptor.
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
void getMyElements(std::vector< stk::mesh::Entity > &elements) const
#define TEUCHOS_ASSERT(assertion_test)
stk::mesh::EntityRank getNodeRank() const
virtual void completeMeshConstruction(STK_Interface &mesh, stk::ParallelMachine parallelMach) const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
From ParameterListAcceptor.
void addElementBlock(const std::string &name, const CellTopologyData *ctData)