Panzer  Version of the Day
Panzer_STK_SculptMeshFactory.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 
47 #include "elsa.h"
48 using Teuchos::RCP;
49 using Teuchos::rcp;
50 
51 
52 
53 namespace panzer_stk {
54 
56 {
58 }
59 
62 {
63 }
64 
66 Teuchos::RCP<STK_Interface> SculptMeshFactory::buildMesh(stk::ParallelMachine parallelMach) const
67 {
68  PANZER_FUNC_TIME_MONITOR("panzer::SculptMeshFactory::buildMesh()");
69 
70  RCP<STK_Interface> mesh = buildUncommitedMesh(parallelMach);
71 
72  // commit meta data
73  mesh->initialize(parallelMach);
74 
75  // build bulk data
76  completeMeshConstruction(*mesh,parallelMach);
77 
78  // wrtie exodus file
79  //mesh->writeToExodus("STKSculptMesh.exo");
80 
81  return mesh;
82 }
83 
84 Teuchos::RCP<STK_Interface> SculptMeshFactory::buildUncommitedMesh(stk::ParallelMachine parallelMach) const
85 {
86  PANZER_FUNC_TIME_MONITOR("panzer::SculptMeshFactory::buildUncomittedMesh()");
87 
88  RCP<STK_Interface> mesh = rcp(new STK_Interface(3));
89 
90  machRank_ = stk::parallel_machine_rank(parallelMach);
91  machSize_ = stk::parallel_machine_size(parallelMach);
92 
94 
95  //if( machRank_ == 0 )
96  {
97  // call Sculptor
98  char diatom_file[1000];
99  writeDiatomFile( stlFileDir_, stlFileName_, diatom_file );
100 
101  callSculptor( parallelMach, diatom_file );
102 
103  // build meta information: blocks and side set setups
104  buildMetaData(parallelMach,*mesh);
105 
106  mesh->addPeriodicBCs(periodicBCVec_);
107 
108  }
109 
110 // if( machRank_ == 0 )
111 // if(mesh->isWritable())
112 // mesh->writeToExodus("STKSculptMesh.exo");
113 
114 
115  return mesh;
116 }
117 
118 int SculptMeshFactory::writeDiatomFile( std::string stl_path, std::string stl_filename, char *diatom_file ) const
119 {
120 
121  strcpy( diatom_file, stl_path.c_str() );
122  strcat( diatom_file, "stl.diatom" );
123  FILE *fp = fopen( diatom_file, "w" );
124  if ( !fp )
125  {
126  printf( "ERROR: Unable to open %s for writing\n", diatom_file );
127  return 0;
128  }
129 
130  char stl_fullfile[1000];
131  strcpy( stl_fullfile, stl_path.c_str() );
132  strcat( stl_fullfile, stl_filename.c_str() );
133 
134  fprintf( fp, " diatom\n" );
135  fprintf( fp, " package \'box\'\n" );
136  fprintf( fp, " material 1\n" );
137  fprintf( fp, " insert stl\n" );
138  fprintf( fp, " FILE = \'%s\'\n", stl_fullfile );
139  fprintf( fp, " endinsert\n" );
140  fprintf( fp, " endpackage\n" );
141  fprintf( fp, " enddiatom\n" );
142  fclose( fp );
143 
144  return 1;
145 
146 }
147 int SculptMeshFactory::callSculptor(stk::ParallelMachine parallelMach, char *diatom_file_name ) const
148 {
149 
150  char * base_exodus_file_name = NULL;
151  char * base_vfrac_file_name = NULL;
152  int nelx, nely, nelz;
153 
154  nelx = xInterval_;
155  nely = yInterval_;
156  nelz = zInterval_;
157 
158  int mesh_void = 0;
159 
160  double gmin[3];
161  double gmax[3];
162 
163  gmin[0] = xMin_;
164  gmin[1] = yMin_;
165  gmin[2] = zMin_;
166  gmax[0] = xMax_;
167  gmax[1] = yMax_;
168  gmax[2] = zMax_;
169 
170  int stair = 0;
171  int smooth = 1;
172  int smooth_iterations = 7;
173 
174  int gen_sidesets = 4; //for stl based sidesets
175  int adaptive_grid = 0;
176  int adapt_level = 2;
177  int adapt_type = 0;
178 
179  printf("\n Sculpt BBox Min ( %lf, %lf, %lf )\n", xMin_, yMin_, zMin_ );
180  printf("\n Sculpt BBox Max ( %lf, %lf, %lf )\n", xMax_, yMax_, zMax_ );
181 
182  int cr_result = Create_Sculptor_Mesh(diatom_file_name,
183  base_exodus_file_name,
184  base_vfrac_file_name,
185  0, //vfac_input
186  machSize_, //comm.size(),
187  machRank_, //comm.rank(),
188  1,
189  nelx,
190  nely,
191  nelz,
192  gmin,
193  gmax,
194  stair,
195  smooth,
196  10,/*num_laplac_iters*/
197  0, // max opt iters
198  .4,/*opt_threshold*/
199  0, // max pcol iters
200  .4, // pcol threshold
201  mesh_void,
202  gen_sidesets,
203  adapt_type, /* adatptive type*/
204  adaptive_grid,/*adaptive_grid*/
205  adapt_level, /* adapt level */
206  0, // max deg iter
207  0.0,/*double htet_threshold*/
208  0,/*int pillow*/
209  0, // capture
210  0, //micro_expand
211  0, //align
212  0, //cell_size
213  NULL,/*char * quality_filename*/
214  NULL,/*char * comm_maps_file_name*/
215  0, // write geom
216  0/*int quiet 1 is quiet*/
217  );
218 
219 
220 
221  if (cr_result == 1){
222  if(machRank_ == 0)
223  printf("Error Generating Sculptor Mesh\n");
224  return 1;
225  }
226 
227  return 0;
228 }
229 
230 void SculptMeshFactory::completeMeshConstruction(STK_Interface & mesh,stk::ParallelMachine parallelMach) const
231 {
232  PANZER_FUNC_TIME_MONITOR("panzer::SculptMeshFactory::completeMeshConstruction()");
233 
234  if(not mesh.isInitialized())
235  mesh.initialize(parallelMach);
236 
237  buildElements(parallelMach,mesh);
238 
239  mesh.buildSubcells();
240  mesh.buildLocalElementIDs();
241  mesh.buildLocalEdgeIDs();
242  mesh.buildLocalFaceIDs();
243 
244  addSideSets(mesh);
245  addNodeSets(mesh);
246  addEdgeBlocks(mesh);
247  addFaceBlocks(mesh);
248 
249  this->rebalance(mesh);
250 }
251 
253 void SculptMeshFactory::setParameterList(const Teuchos::RCP<Teuchos::ParameterList> & paramList)
254 {
255  paramList->validateParametersAndSetDefaults(*getValidParameters(),0);
256 
257  setMyParamList(paramList);
258 
259  xInterval_ = paramList->get<int>("xInterval");
260  yInterval_ = paramList->get<int>("yInterval");
261  zInterval_ = paramList->get<int>("zInterval");
262 
263 
264  xMin_ = paramList->get<double>("xMin");
265  yMin_ = paramList->get<double>("yMin");
266  zMin_ = paramList->get<double>("zMin");
267 
268  xMax_ = paramList->get<double>("xMax");
269  yMax_ = paramList->get<double>("yMax");
270  zMax_ = paramList->get<double>("zMax");
271 
272  stlFileDir_ = paramList->get<std::string>("stlFileDir");
273  stlFileName_ = paramList->get<std::string>("stlFileName");
274 
275  // read in periodic boundary conditions
276  parsePeriodicBCList(Teuchos::rcpFromRef(paramList->sublist("Periodic BCs")),periodicBCVec_);
277 }
278 
280 Teuchos::RCP<const Teuchos::ParameterList> SculptMeshFactory::getValidParameters() const
281 {
282  static RCP<Teuchos::ParameterList> defaultParams;
283 
284  // fill with default values
285  if(defaultParams == Teuchos::null) {
286  defaultParams = rcp(new Teuchos::ParameterList);
287 
288  defaultParams->set<int>("xInterval",10);
289  defaultParams->set<int>("yInterval",10);
290  defaultParams->set<int>("zInterval",10);
291 
292  defaultParams->set<double>("xMin",0.0);
293  defaultParams->set<double>("yMin",0.0);
294  defaultParams->set<double>("zMin",0.0);
295 
296  defaultParams->set<double>("xMax",1.0);
297  defaultParams->set<double>("yMax",1.0);
298  defaultParams->set<double>("zMax",1.0);
299 
300  defaultParams->set<std::string>("stlFileDir", "NULL");
301  defaultParams->set<std::string>("stlFileName", "NULL");
302 
303  Teuchos::ParameterList & bcs = defaultParams->sublist("Periodic BCs");
304  bcs.set<int>("Count",0); // no default periodic boundary conditions
305  }
306 
307 
308  return defaultParams;
309 }
310 
312 {
313  // get valid parameters
314  RCP<Teuchos::ParameterList> validParams = rcp(new Teuchos::ParameterList(*getValidParameters()));
315 
316  // set that parameter list
317  setParameterList(validParams);
318 
319 }
320 
321 void SculptMeshFactory::buildMetaData(stk::ParallelMachine parallelMach, STK_Interface & mesh) const
322 {
323  struct MeshStorageStruct *mss = get_sculpt_mesh();
324 
325  int nBlocks_ = mss->num_elem_blk;
326  int nSidesets_ = mss->num_side_sets;
327  int nNodesets_ = mss->num_node_sets;
328 
329 
330  typedef shards::Hexahedron<8> HexTopo;
331  const CellTopologyData * ctd = shards::getCellTopologyData<HexTopo>();
332  const CellTopologyData * side_ctd = shards::CellTopology(ctd).getBaseCellTopologyData(2,0);
333 
334  const CellTopologyData * edge_ctd = shards::CellTopology(ctd).getBaseCellTopologyData(1,0);
335  const CellTopologyData * face_ctd = shards::CellTopology(ctd).getBaseCellTopologyData(2,0);
336 
337 
338  // build meta data
339  //mesh.setDimension(3);
340  for( int b = 0; b < nBlocks_; b++){
341  std::stringstream ebPostfix;
342  ebPostfix << "-" << mss->block_id[b];
343  mesh.addElementBlock("eblock"+ebPostfix.str(),ctd);
344  }
345 
346 
347  // add sidesets
348  int side_set_id;
349  machRank_ = stk::parallel_machine_rank(parallelMach);
350  for(int ict = 0;ict < nSidesets_;ict ++){
351  std::stringstream sPostfix;
352  sPostfix << "-" << mss->side_set_id[ict];
353  mesh.addSideset("Sideset"+sPostfix.str(),side_ctd);
354  }
355 
356  // add nodesets
357  for(int nx=0;nx<nNodesets_;nx++) {
358  std::stringstream nPostfix;
359  nPostfix << "-" << nx;
360  mesh.addNodeset("Nodeset"+nPostfix.str());
361  }
362 
365 }
366 
367 void SculptMeshFactory::buildNodes( stk::ParallelMachine paralleMach, STK_Interface &mesh ) const
368 {
369  struct MeshStorageStruct *mss = get_sculpt_mesh();
370  int num_nodes = mss->num_nodes;
371 
372 
373  int dimensionality = 3;
374 
375  if (num_nodes){
376  int global_node_numbers;
377  for(int ict = 0; ict < num_nodes; ict ++){
378  global_node_numbers = mss->global_node_numbers[ict];
379  std::vector<double> coord(3, 0.0);
380  coord[0] = mss->coord[0*num_nodes+ict];
381  coord[1] = mss->coord[1*num_nodes+ict];
382  coord[2] = mss->coord[2*num_nodes+ict];
383  mesh.addNode(global_node_numbers, coord );
384 
385  //std::cout<<"Node "<<global_node_numbers<<": ( "<<coord[0]<<", "<<coord[1]<<", "<<coord[2]<<" )"<<std::endl;
386 
387  }
388  }
389 
390 
391 }
392 
393 void SculptMeshFactory::buildElements(stk::ParallelMachine parallelMach,STK_Interface & mesh) const
394 {
395  struct MeshStorageStruct *mss = get_sculpt_mesh();
396  int num_blocks = mss->num_elem_blk;
397 
398 
399  int *block_id = new int[num_blocks];
400  //char ** element_types = new std::string[num_blocks];
401  int *elements = new int[num_blocks];
402  int *nodes_per_element = new int[num_blocks];
403  int *element_attributes = new int[num_blocks];
404  int **elmt_node_linkage = new int*[num_blocks];
405 
406  for(int b = 0; b < num_blocks; b++){
407  block_id[b] = mss->block_id[b];
408  // element_types[b] = mss->element_types[b];
409  elements[b] = mss->elements[b];
410  nodes_per_element[b] = mss->nodes_per_element[b];
411  element_attributes[b] = mss->element_attributes[b];
412  }
413 
414 
415  int elm_start = 1;
416  mesh.beginModification();
417  // build each block
418  for(int ib=0;ib<num_blocks;ib++) {
419  buildBlock(parallelMach,mesh, ib, block_id, elm_start, elements, nodes_per_element, element_attributes, elmt_node_linkage );
420  elm_start += elements[ib];
421  }
422  mesh.endModification();
423 }
424 
425 void SculptMeshFactory::buildBlock(stk::ParallelMachine parallelMach,STK_Interface & mesh, int block_index, int *block_id, int elm_start, int *elements, int *nodes_per_element, int *elem_attributes, int **elmt_node_linkage ) const
426 {
427 
428  struct MeshStorageStruct *mss = get_sculpt_mesh();
429 
430  // add blocks
431  std::stringstream blockName;
432  blockName << "eblock-" << block_id[block_index];
433  stk::mesh::Part * block = mesh.getElementBlockPart(blockName.str());
434 
435 
436  buildNodes( parallelMach, mesh );
437 
438 
439  // read element block properties
440  //read element connectivity information into a temporary array
441  if(elements[block_index]) {
442  int maximum_nodes = elements[block_index] * nodes_per_element[block_index];
443  elmt_node_linkage[block_index] = new int[maximum_nodes];
444  for(int ict = 0;ict < elements[block_index]; ict ++){
445  std::vector<stk::mesh::EntityId> nodes(nodes_per_element[block_index]);
446  //std::cout<<"Element id = "<<elm_start+ ict<<std::endl;
447  //std::cout<<"Element global id = "<<mss->global_element_numbers[elm_start+ ict-1]<<std::endl;
448  for(int nct = 0; nct < nodes_per_element[block_index]; nct++){
449  elmt_node_linkage[block_index][(ict*nodes_per_element[block_index])+nct] = mss->elmt_node_linkage[block_index][(ict*nodes_per_element[block_index])+nct];
450  nodes[nct] = mss->global_node_numbers[elmt_node_linkage[block_index][(ict*nodes_per_element[block_index])+nct]-1];
451  //std::cout<<" Node linkage id = "<<elmt_node_linkage[block_index][(ict*nodes_per_element[block_index])+nct]<<std::endl;
452  //std::cout<<" Node global id = "<<nodes[nct]<<std::endl;
453  }
454 
455  stk::mesh::EntityId gid = mss->global_element_numbers[elm_start+ ict-1];
456  RCP<ElementDescriptor> ed = rcp(new ElementDescriptor(gid,nodes));
457  mesh.addElement(ed,block);
458  }
459  }
460  else {
461  elmt_node_linkage[block_index] = NULL;
462  }
463 }
464 
465 const stk::mesh::Relation * SculptMeshFactory::getRelationByID(unsigned ID,stk::mesh::PairIterRelation relations) const
466 {
467  for(std::size_t i=0;i<relations.size();i++)
468  if(relations[i].identifier()==ID)
469  return &relations[i];
470 
471  return 0;
472 }
473 
474 
475 
477 {
478  mesh.beginModification();
479 
480  struct MeshStorageStruct *mss = get_sculpt_mesh();
481  int num_side_sets = mss->num_side_sets;
482 
483  int *side_set_id = new int[num_side_sets];
484  int *num_elements_in_side_set = new int[num_side_sets];
485  int *num_nodes_in_side_set = new int[num_side_sets];
486  int *num_df_in_side_set = new int[num_side_sets];
487  int **side_set_elements = new int*[num_side_sets];
488  int **side_set_faces = new int*[num_side_sets];
489  //Element_Type **side_set_element_type = new Element_Type*[num_side_sets];
490  int **side_set_node_counter = new int*[num_side_sets];
491  int **side_set_nodes = new int*[num_side_sets];
492  double **side_set_df = new double*[num_side_sets];
493 
494  for(int ict = 0;ict < num_side_sets;ict ++){
495  side_set_id[ict] = mss->side_set_id[ict];
496  }
497 
498  for(int i = 0; i < num_side_sets; i++) {
499 
500  std::stringstream sidesetName;
501  sidesetName << "Sideset-" << mss->side_set_id[i];
502  stk::mesh::Part * sideset = mesh.getSideset(sidesetName.str());
503 
504 
505  num_elements_in_side_set[i] = mss->num_elements_in_side_set[i];
506  num_df_in_side_set[i] = mss->num_df_in_side_set[i];
507 
508  int ne = num_elements_in_side_set[i];
509  side_set_elements[i] = new int[ne];
510  side_set_faces[i] = new int[ne];
511  //side_set_element_type[i] = new Element_Type[ne];
512  side_set_node_counter[i] = new int[ne];
513  side_set_df[i] = new double[num_df_in_side_set[i]];
514 
515 
516  if(ne) {
517 
518  for(int nct = 0; nct < ne; nct ++){
519 
520  std::vector<stk::mesh::EntityId> nodes(4);
521 
522  int sculpt_elem_id = mss->global_element_numbers[ mss->side_set_elements[i][nct]-1 ];
523  int sculpt_face_id = -1 ;
524 
525  std::vector<stk::mesh::Entity> localElmts;
526  mesh.getMyElements(localElmts);
527 
528  std::vector<stk::mesh::Entity>::const_iterator itr;
529  for(itr=localElmts.begin();itr!=localElmts.end();++itr) {
530  stk::mesh::Entity element = (*itr);
531 
532  if( element->identifier() == sculpt_elem_id )
533  {
534  sculpt_face_id = mss->side_set_faces[i][nct];
535 
536  stk::mesh::EntityId gid = element->identifier();
537 
538  stk::mesh::PairIterRelation relations = element->relations(mesh.getSideRank());
539 
540  stk::mesh::Entity side = getRelationByID(sculpt_face_id-1,relations)->entity();
541 
542  if( side != NULL )
543  {
544  if(side->owner_rank()==machRank_)
545  mesh.addEntityToSideset(*side,sideset );
546  }
547  }
548  }
549 
550  if( sculpt_face_id == -1 )
551  printf(" ERROR: Could not find the element id for a sideset face \n");
552  }
553  }
554  }
555  mesh.endModification();
556 }
557 
559 {
560  mesh.beginModification();
561 
562  struct MeshStorageStruct *mss = get_sculpt_mesh();
563  int num_node_sets = mss->num_node_sets;
564 
565 
566  if (num_node_sets) {
567  int *node_set_id = new int[num_node_sets];
568  int *num_nodes_in_node_set = new int[num_node_sets];
569  int *num_df_in_node_set = new int[num_node_sets];
570  int **node_set_nodes = new int*[num_node_sets];
571  double **node_set_df = new double*[num_node_sets];
572 
573  for(int ict = 0; ict < num_node_sets; ict ++){
574  node_set_id[ict] = mss->node_set_id[ict];
575  num_nodes_in_node_set[ict] = mss->num_nodes_in_node_set[ict];
576  num_df_in_node_set[ict] = mss->num_df_in_node_set[ict];
577  }
578 
579  for(int i = 0; i < num_node_sets; i++) {
580  node_set_nodes[i] = new int[num_nodes_in_node_set[i]];
581  node_set_df[i] = NULL;
582  if(num_nodes_in_node_set[i]) {
583  for(int nct = 0; nct < num_nodes_in_node_set[i];nct ++){
584  node_set_nodes[i][nct] = mss->node_set_nodes[i][nct];
585  }
586  }
587  }
588 
589 
590  for(int i = 0; i < num_node_sets; i++) {
591 
592  std::stringstream nodesetName;
593  nodesetName << "Nodeset-" << mss->node_set_id[i];
594  stk::mesh::Part * nodeset = mesh.getNodeset(nodesetName.str());
595 
596  for( int j = 0; j < num_nodes_in_node_set[i]; j++ )
597  {
598  int node_id = node_set_nodes[i][j];
599  Teuchos::RCP<stk::mesh::BulkData> bulkData = mesh.getBulkData();
600  if(machRank_==0)
601  {
602  stk::mesh::Entity node = bulkData->get_entity(mesh.getNodeRank(),node_id);
603  mesh.addEntityToNodeset(*node, nodeset);
604  }
605  }
606  }
607 
608  }
609  mesh.endModification();
610 }
611 
612 void ScupltMeshFactory::addEdgeBlocks(STK_Interface & mesh) const
613 {
614  mesh.beginModification();
615 
616  stk::mesh::Part * edge_block = mesh.getEdgeBlock(panzer_stk::STK_Interface::edgeBlockString);
617 
618  Teuchos::RCP<stk::mesh::BulkData> bulkData = mesh.getBulkData();
619  Teuchos::RCP<stk::mesh::MetaData> metaData = mesh.getMetaData();
620 
621  std::vector<stk::mesh::Entity> edges;
622  bulkData->get_entities(mesh.getEdgeRank(),metaData->locally_owned_part(),edges);
623  for(auto edge : edges) {
624  mesh.addEntityToEdgeBlock(edge, edge_block);
625  }
626 
627  mesh.endModification();
628 }
629 
630 void ScupltMeshFactory::addFaceBlocks(STK_Interface & mesh) const
631 {
632  mesh.beginModification();
633 
634  stk::mesh::Part * face_block = mesh.getFaceBlock(panzer_stk::STK_Interface::faceBlockString);
635 
636  Teuchos::RCP<stk::mesh::BulkData> bulkData = mesh.getBulkData();
637  Teuchos::RCP<stk::mesh::MetaData> metaData = mesh.getMetaData();
638 
639  std::vector<stk::mesh::Entity> faces;
640  bulkData->get_entities(mesh.getFaceRank(),metaData->locally_owned_part(),faces);
641  for(auto face : faces) {
642  mesh.addEntityToFaceBlock(face, face_block);
643  }
644 
645  mesh.endModification();
646 }
647 
649 Teuchos::Tuple<std::size_t,2> SculptMeshFactory::procRankToProcTuple(std::size_t procRank) const
650 {
651  std::size_t i=0,j=0;
652 
653  j = procRank/machSize_;
654  procRank = procRank % machSize_;
655  i = procRank;
656 
657  return Teuchos::tuple(i,j);
658 }
659 
660 } // end panzer_stk
Teuchos::RCP< stk::mesh::MetaData > getMetaData() const
stk::mesh::Part * getElementBlockPart(const std::string &name) const
get the block part
void addNodeset(const std::string &name)
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
From ParameterListAcceptor.
Teuchos::RCP< STK_Interface > buildMesh(stk::ParallelMachine parallelMach) const
Build the mesh object.
void addEntityToNodeset(stk::mesh::Entity entity, stk::mesh::Part *nodeset)
int callSculptor(stk::ParallelMachine parallelMach, char *diatom_file) const
void addNodeSets(STK_Interface &mesh) const
void getMyElements(std::vector< stk::mesh::Entity > &elements) const
void addEntityToSideset(stk::mesh::Entity entity, stk::mesh::Part *sideset)
stk::mesh::EntityRank getNodeRank() const
Teuchos::RCP< stk::mesh::BulkData > getBulkData() const
stk::mesh::EntityRank getSideRank() const
void addEdgeBlocks(STK_Interface &mesh) const
stk::mesh::Part * getEdgeBlock(const std::string &name) const
get the block part
void addSideSets(STK_Interface &mesh) const
stk::mesh::EntityRank getEdgeRank() const
void addFaceBlocks(STK_Interface &mesh) const
stk::mesh::Part * getSideset(const std::string &name) const
void addElement(const Teuchos::RCP< ElementDescriptor > &ed, stk::mesh::Part *block)
void initialize(stk::ParallelMachine parallelMach, bool setupIO=true, const bool buildRefinementSupport=false)
void buildElements(stk::ParallelMachine parallelMach, STK_Interface &mesh) const
Teuchos::Tuple< std::size_t, 2 > procTuple_
bool isInitialized() const
Has initialize been called on this mesh object?
static const std::string edgeBlockString
void buildMetaData(stk::ParallelMachine parallelMach, STK_Interface &mesh) const
void buildNodes(stk::ParallelMachine parallelMach, 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 addFaceBlock(const std::string &name, const CellTopologyData *ctData)
void addNode(stk::mesh::EntityId gid, const std::vector< double > &coord)
void buildSubcells()
force the mesh to build subcells: edges and faces
void buildBlock(stk::ParallelMachine parallelMach, STK_Interface &mesh, int block_index, int *block_id, int elem_start, int *elements, int *nodes_per_elem, int *elem_attributes, int **elm_node_linkage) const
virtual void completeMeshConstruction(STK_Interface &mesh, stk::ParallelMachine parallelMach) const
void addSideset(const std::string &name, const CellTopologyData *ctData)
static const std::string faceBlockString
void addEntityToEdgeBlock(stk::mesh::Entity entity, stk::mesh::Part *edgeblock)
void addEdgeBlock(const std::string &name, const CellTopologyData *ctData)
std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > periodicBCVec_
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &paramList)
From ParameterListAcceptor.
virtual Teuchos::RCP< STK_Interface > buildUncommitedMesh(stk::ParallelMachine parallelMach) const
int writeDiatomFile(std::string stl_path, std::string stl_filename, char *diatom_file) const
void rebalance(STK_Interface &mesh) const
void addElementBlock(const std::string &name, const CellTopologyData *ctData)
const stk::mesh::Relation * getRelationByID(unsigned ID, stk::mesh::PairIterRelation edges) const
stk::mesh::Part * getNodeset(const std::string &name) const
static void parsePeriodicBCList(const Teuchos::RCP< Teuchos::ParameterList > &pl, std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > &periodicBC)