Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GEM_Partition Class Reference

#include <GEM.H>

Inheritance diagram for GEM_Partition:
Collaboration diagram for GEM_Partition:

Public Member Functions

bool validate_comm_list (int ncsend, int ncrecv, int *csend, int *crecv)
 
bool ValidateMesh ()
 
void AddParitionBoundary (int rpid, int nnshare, int nnsend, int nnrecv, int ncsend, int ncrecv, int *nshared, int *nsend, int *nrecv, int *csend, int *crecv)
 
void AddDomainBoundary (int db_id, int ntri, int ngtri, int *tris, int nquad, int ngquad, int *quads)
 
bool SetSolverDataBlock (const std::string &wname, double *cell_data, int nval_cells, double *node_data, int nval_nodes)
 
bool AddSolverDataBlock (const std::string &wname, double *cell_data, int nval_cells, double *node_data, int nval_nodes)
 
bool debug (bool s=true)
 
void ResolveCellMapping (GEM_Partition &sp)
 
void SetNodalCoordinates (double *data, int nn, int ng)
 
void SetVolumeElements (int *data, int ncells, int ng, int npe)
 
bool PopulatePartitionBoundaries (std::vector< GEM_PartitionBoundary > &pb)
 
void MapDomainBoundaries (std::map< unsigned int, unsigned int > &bcmap)
 
void report ()
 
void report_partition_boundaries ()
 
void report_domain_boundaries ()
 
unsigned int nelem ()
 
unsigned int Elem2Cell (std::pair< unsigned int, unsigned int >)
 
std::pair< unsigned int,
unsigned int > 
Cell2Elem (unsigned int)
 
void Register_com_volconn (const std::string &wname, int paneid, unsigned int nel, unsigned int ngel, std::vector< unsigned int > &conn, unsigned int esize, bool ghost_part=false)
 
bool WindowInitDone ()
 
bool DestroyWindows ()
 
bool WriteRocstar (const std::string &, double t=0.0)
 
bool ReadRocstar (const std::string &, double t=0.0)
 
bool InitRoccomWindows (const std::string &wname)
 
void Create_com_pconn (std::vector< unsigned int > rpids, std::vector< std::vector< std::vector< unsigned int > > > &index_vectors, unsigned int &nreal, unsigned int &ng, std::vector< int > &pc)
 
bool CreatePconn (const std::string &wname)
 
bool PopulateVolumeWindow (const std::string &wname)
 
bool PopulateSurfaceWindow (const std::string &wname)
 
void Create_com_volsoln (const std::string &fname, std::vector< double > &fvec, unsigned int ncomp, const std::string &unit)
 
 GEM_Partition (const GEM_Partition &gp)
 
 GEM_Partition ()
 
 GEM_Partition (unsigned int id, MPI_Comm comm=MPI_COMM_NULL)
 
GEM_Partitionoperator= (const GEM_Partition &gp)
 

Public Attributes

unsigned int _id
 
unsigned int _npart
 
unsigned int _ngnodes
 
unsigned int _ngtet
 
unsigned int _nghex
 
unsigned int _ngpyr
 
unsigned int _ngpris
 
unsigned int _nvface
 
std::vector< double > _nc
 
std::vector< unsigned int > _tetconn
 
std::vector< unsigned int > _pyrconn
 
std::vector< unsigned int > _prisconn
 
std::vector< unsigned int > _hexconn
 
unsigned int _cell_ordering [4]
 
std::vector
< GEM_PartitionBoundary
_pb
 
std::vector< GEM_DomainBoundary_db
 
GEM_UserData _data
 
GEM_UserData _solver_data
 
std::ostream * _out
 
bool _debug
 
MPI_Comm _comm
 
int pane_id
 
std::vector< int > pconn
 
unsigned int pconn_nghost
 
std::string volume_window
 
std::string surface_window
 

Detailed Description

Definition at line 282 of file GEM.H.

Constructor & Destructor Documentation

GEM_Partition ( const GEM_Partition gp)
inline

Definition at line 420 of file GEM.H.

References _cell_ordering, _comm, _debug, _hexconn, _id, _nc, _nghex, _ngnodes, _ngpris, _ngpyr, _ngtet, _nvface, _out, _prisconn, _pyrconn, and _tetconn.

421  {
422  _out = gp._out;
423  _id = gp._id;
424  _ngnodes = gp._ngnodes;
425  _ngtet = gp._ngtet;
426  _nghex = gp._nghex;
427  _ngpyr = gp._ngpyr;
428  _ngpris = gp._ngpris;
429  _nc = gp._nc;
430  _tetconn = gp._tetconn;
431  _pyrconn = gp._pyrconn;
432  _prisconn = gp._prisconn;
433  _hexconn = gp._hexconn;
434  _nvface = gp._nvface;
435  _debug = gp._debug;
436  _cell_ordering[0] = gp._cell_ordering[0];
437  _cell_ordering[1] = gp._cell_ordering[1];
438  _cell_ordering[2] = gp._cell_ordering[2];
439  _cell_ordering[3] = gp._cell_ordering[3];
440  //#ifdef _TRAIL_MPI_
441  _comm = gp._comm;
442  //#endif
443  };
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
unsigned int _ngnodes
Definition: GEM.H:286
unsigned int _cell_ordering[4]
Definition: GEM.H:303
unsigned int _ngpris
Definition: GEM.H:290
unsigned int _nvface
Definition: GEM.H:291
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
std::vector< unsigned int > _pyrconn
Definition: GEM.H:297
std::vector< unsigned int > _hexconn
Definition: GEM.H:301
MPI_Comm _comm
Definition: GEM.H:312
bool _debug
Definition: GEM.H:310
unsigned int _ngtet
Definition: GEM.H:287
std::vector< double > _nc
Definition: GEM.H:293
std::vector< unsigned int > _prisconn
Definition: GEM.H:299
unsigned int _ngpyr
Definition: GEM.H:289
unsigned int _nghex
Definition: GEM.H:288
GEM_Partition ( )
inline

Definition at line 444 of file GEM.H.

References _cell_ordering, _comm, _debug, _hexconn, _id, _nc, _nghex, _ngnodes, _ngpris, _ngpyr, _ngtet, _nvface, _out, _prisconn, _pyrconn, and _tetconn.

445  {
446  _id = 0;
447  _out = NULL;
448  _ngnodes = 0;
449  _ngtet = 0;
450  _nghex = 0;
451  _ngpyr = 0;
452  _ngpris = 0;
453  _nvface = 0;
454  _nc.resize(0);
455  _debug = false;
456  _tetconn.resize(0);
457  _pyrconn.resize(0);
458  _prisconn.resize(0);
459  _hexconn.resize(0);
460  _cell_ordering[0] = 1;
461  _cell_ordering[1] = 2;
462  _cell_ordering[2] = 3;
463  _cell_ordering[3] = 4;
464  //#ifdef _TRAIL_MPI_
465  _comm = MPI_COMM_NULL;
466  //#endif
467  };
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
unsigned int _ngnodes
Definition: GEM.H:286
unsigned int _cell_ordering[4]
Definition: GEM.H:303
unsigned int _ngpris
Definition: GEM.H:290
unsigned int _nvface
Definition: GEM.H:291
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
std::vector< unsigned int > _pyrconn
Definition: GEM.H:297
std::vector< unsigned int > _hexconn
Definition: GEM.H:301
MPI_Comm _comm
Definition: GEM.H:312
bool _debug
Definition: GEM.H:310
unsigned int _ngtet
Definition: GEM.H:287
std::vector< double > _nc
Definition: GEM.H:293
std::vector< unsigned int > _prisconn
Definition: GEM.H:299
unsigned int _ngpyr
Definition: GEM.H:289
unsigned int _nghex
Definition: GEM.H:288
GEM_Partition ( unsigned int  id,
MPI_Comm  comm = MPI_COMM_NULL 
)
inline

Definition at line 469 of file GEM.H.

References _cell_ordering, _debug, _hexconn, _nc, _nghex, _ngnodes, _ngpris, _ngpyr, _ngtet, _nvface, _out, _prisconn, _pyrconn, and _tetconn.

470  : _id(id), _comm(comm)
471  {
472  _out = NULL;
473  _ngnodes = 0;
474  _ngtet = 0;
475  _nghex = 0;
476  _ngpyr = 0;
477  _ngpris = 0;
478  _nvface = 0;
479  _nc.resize(0);
480  _debug = false;
481  _tetconn.resize(0);
482  _pyrconn.resize(0);
483  _prisconn.resize(0);
484  _hexconn.resize(0);
485  _cell_ordering[0] = 1;
486  _cell_ordering[1] = 2;
487  _cell_ordering[2] = 3;
488  _cell_ordering[3] = 4;
489  };
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
unsigned int _ngnodes
Definition: GEM.H:286
unsigned int _cell_ordering[4]
Definition: GEM.H:303
unsigned int _ngpris
Definition: GEM.H:290
unsigned int _nvface
Definition: GEM.H:291
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
std::vector< unsigned int > _pyrconn
Definition: GEM.H:297
std::vector< unsigned int > _hexconn
Definition: GEM.H:301
MPI_Comm _comm
Definition: GEM.H:312
bool _debug
Definition: GEM.H:310
unsigned int _ngtet
Definition: GEM.H:287
std::vector< double > _nc
Definition: GEM.H:293
std::vector< unsigned int > _prisconn
Definition: GEM.H:299
unsigned int _ngpyr
Definition: GEM.H:289
unsigned int _nghex
Definition: GEM.H:288

Member Function Documentation

void AddDomainBoundary ( int  db_id,
int  ntri,
int  ngtri,
int *  tris,
int  nquad,
int  ngquad,
int *  quads 
)

Definition at line 1227 of file GEM.C.

References GEM_DomainBoundary::_debug, GEM_DomainBoundary::_id, GEM_DomainBoundary::_ngquad, GEM_DomainBoundary::_ngtri, GEM_DomainBoundary::_nnodes, GEM_DomainBoundary::_out, GEM_DomainBoundary::_quadconn, GEM_DomainBoundary::_triconn, and GEM_DomainBoundary::NNodes().

1229 {
1230  assert(ntri >= ngtri && nquad >= ngquad);
1231  if(_debug && _out)
1232  *_out << "GEM_Mesh(" << _id << ")::AddDomainBoundary: "
1233  << "Adding domain boundary with"
1234  << " id " << db_id << "." << endl;
1235  GEM_DomainBoundary new_db;
1236  new_db._id = db_id;
1237  new_db._ngtri = ngtri;
1238  new_db._ngquad = ngquad;
1239  int indy = 0;
1240  new_db._triconn.resize(3*ntri);
1241  new_db._quadconn.resize(4*nquad);
1242  new_db._out = _out;
1243  new_db._debug = _debug;
1244  while(indy < 3*ntri){
1245  assert(tris[indy] != 0);
1246  new_db._triconn[indy] = tris[indy];
1247  indy++;
1248  }
1249  indy = 0;
1250  while(indy < 4*nquad){
1251  assert(quads[indy] != 0);
1252  new_db._quadconn[indy] = quads[indy];
1253  indy++;
1254  }
1255  new_db._nnodes = new_db.NNodes();
1256  unsigned int csize = _db.size();
1257  if(_debug && _out)
1258  *_out << "GEM_Partition(" << _id << ")::AddDomainBoundary: "
1259  << "DomainBoundary " << csize << " has (nodes,tri,gtri,quad,gquad)"
1260  << " = (" << new_db._nnodes << "," << ntri << "," << ngtri << ","
1261  << nquad << "," << ngquad << ")" << std::endl;
1262  _db.push_back(new_db);
1263 }
unsigned int _nnodes
Definition: GEM.H:130
unsigned int NNodes(void)
Definition: GEM.C:1103
std::vector< unsigned int > _quadconn
Definition: GEM.H:132
unsigned int _id
Definition: GEM.H:127
std::vector< unsigned int > _triconn
Definition: GEM.H:131
unsigned int _id
Definition: GEM.H:284
std::vector< GEM_DomainBoundary > _db
Definition: GEM.H:305
std::ostream * _out
Definition: GEM.H:308
unsigned int _ngquad
Definition: GEM.H:129
bool _debug
Definition: GEM.H:310
std::ostream * _out
Definition: GEM.H:140
unsigned int _ngtri
Definition: GEM.H:128

Here is the call graph for this function:

void AddParitionBoundary ( int  rpid,
int  nnshare,
int  nnsend,
int  nnrecv,
int  ncsend,
int  ncrecv,
int *  nshared,
int *  nsend,
int *  nrecv,
int *  csend,
int *  crecv 
)

Definition at line 1201 of file GEM.C.

References GEM_PartitionBoundary::_debug, GEM_PartitionBoundary::_out, and GEM_PartitionBoundary::populate().

1205 {
1206  assert(rpid > 0);
1207  if(_debug && _out)
1208  *_out << "GEM_Mesh(" << _id << ")::AddPartitionBoundary: "
1209  << "Adding Border with"
1210  << " partition " << rpid << "." << endl;
1211  GEM_PartitionBoundary new_pb;
1212  new_pb._out = _out;
1213  new_pb._debug = _debug;
1214  if(!validate_comm_list(ncsend,ncrecv,csend,crecv)){
1215  if(_out)
1216  *_out << "GEM_Mesh(" << _id << ")::AddPartitionBoundary"
1217  << ": Validation of "
1218  << "communication arrays failed, aborting." << endl;
1219  exit(-1);
1220  }
1221  new_pb.populate(rpid,nnshare,nnsend,nnrecv,ncsend,ncrecv,
1222  nshared,nsend,nrecv,csend,crecv);
1223  _pb.push_back(new_pb);
1224 }
bool validate_comm_list(int ncsend, int ncrecv, int *csend, int *crecv)
Definition: GEM.C:1149
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
std::ostream * _out
Definition: GEM.H:233
void populate(int rpid, int nnshared, int nnsend, int nnrecv, int ncsend, int ncrecv, int *sharedn, int *sendn, int *recvn, int *sendc, int *recvc)
Definition: GEM.C:193
std::vector< GEM_PartitionBoundary > _pb
Definition: GEM.H:304
bool _debug
Definition: GEM.H:310

Here is the call graph for this function:

bool AddSolverDataBlock ( const std::string &  wname,
double *  cell_data,
int  nval_cells,
double *  node_data,
int  nval_nodes 
)

Definition at line 1072 of file GEM.C.

1075 {
1076  _solver_data._string_data.push_back(wname);
1077  unsigned int current_size = _solver_data._field_data.size();
1078  if(current_size == 0)
1079  _solver_data._field_data.resize(2);
1080  else{
1081  std::vector<double> temp;
1082  _solver_data._field_data.push_back(temp);
1083  _solver_data._field_data.push_back(temp);
1084  _solver_data._stride_field.push_back(0);
1085  _solver_data._stride_field.push_back(0);
1086  }
1087  unsigned int ncells = _tetconn.size()/4 + _hexconn.size()/8 +
1088  _prisconn.size()/6 + _pyrconn.size()/5;
1089  unsigned int nnodes = _nc.size()/3;
1090  _solver_data._field_data[current_size].resize(nval_cells*ncells);
1091  _solver_data._field_data[current_size+1].resize(nval_nodes*nnodes);
1092  _solver_data._stride_field.resize(2);
1093  _solver_data._stride_field[current_size] = nval_cells;
1094  _solver_data._stride_field[current_size+1] = nval_nodes;
1095  memcpy(&_solver_data._field_data[current_size][0],cell_data,
1096  sizeof(double)*nval_cells*ncells);
1097  memcpy(&_solver_data._field_data[current_size+1][0],node_data,
1098  sizeof(double)*nval_nodes*nnodes);
1099  return(true);
1100 }
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
std::vector< std::string > _string_data
Definition: GEM.H:105
std::vector< std::vector< double > > _field_data
Definition: GEM.H:95
std::vector< unsigned int > _pyrconn
Definition: GEM.H:297
std::vector< unsigned int > _hexconn
Definition: GEM.H:301
std::vector< int > _stride_field
Definition: GEM.H:103
GEM_UserData _solver_data
Definition: GEM.H:307
std::vector< double > _nc
Definition: GEM.H:293
std::vector< unsigned int > _prisconn
Definition: GEM.H:299
pair< unsigned int, unsigned int > Cell2Elem ( unsigned int  cell)

Definition at line 875 of file GEM.C.

References offset().

Referenced by ResolveCellMapping().

876 {
877  unsigned int elem_type = 0;
878  unsigned int offset = 0;
879  unsigned int nreal_elems;
880  while(elem_type < 4){
881  switch(_cell_ordering[elem_type]){
882  case 1:
883  nreal_elems = _tetconn.size()/4 - _ngtet;
884  if(cell <= (offset+nreal_elems))
885  return(make_pair(1,cell-offset));
886  else
887  offset += nreal_elems;
888  break;
889  case 2:
890  nreal_elems = _pyrconn.size()/5 - _ngpyr;
891  if(cell <= (offset+nreal_elems))
892  return(make_pair(2,cell-offset));
893  else
894  offset += nreal_elems;
895  break;
896  case 3:
897  nreal_elems = _prisconn.size()/6 - _ngpris;
898  if(cell <= (offset+nreal_elems))
899  return(make_pair(3,cell-offset));
900  else
901  offset += nreal_elems;
902  break;
903  case 4:
904  nreal_elems = _hexconn.size()/8 - _nghex;
905  if(cell <= (offset+nreal_elems))
906  return(make_pair(4,cell-offset));
907  else
908  offset += nreal_elems;
909  break;
910  }
911  elem_type++;
912  }
913  elem_type = 0;
914  while(elem_type < 4){
915  switch(_cell_ordering[elem_type]){
916  case 1:
917  nreal_elems = _tetconn.size()/4 - _ngtet;
918  if(cell <= (offset+_ngtet))
919  return(make_pair(1,cell-offset+nreal_elems));
920  else
921  offset += _ngtet;
922  break;
923  case 2:
924  nreal_elems = _pyrconn.size()/5 - _ngpyr;
925  if(cell <= (offset+_ngpyr))
926  return(make_pair(2,cell-offset+nreal_elems));
927  else
928  offset += _ngpyr;
929  break;
930  case 3:
931  nreal_elems = _prisconn.size()/6 - _ngpris;
932  if(cell <= (offset+_ngpris))
933  return(make_pair(3,cell-offset+nreal_elems));
934  else
935  offset += _ngpris;
936  break;
937  case 4:
938  nreal_elems = _hexconn.size()/8 - _nghex;
939  if(cell <= (offset+_nghex))
940  return(make_pair(4,cell-offset+nreal_elems));
941  else
942  offset += _nghex;
943  break;
944  }
945  elem_type++;
946  }
947  if(_out)
948  *_out << "GEM_Partition(" << _id
949  << ")::Cell2Elem: Fatal error - Could not find cell "
950  << cell << ", dying.\n";
951  exit(1);
952 }
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
real *8 function offset(vNorm, x2, y2, z2)
Definition: PlaneNorm.f90:211
unsigned int _cell_ordering[4]
Definition: GEM.H:303
unsigned int _ngpris
Definition: GEM.H:290
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
std::vector< unsigned int > _pyrconn
Definition: GEM.H:297
std::vector< unsigned int > _hexconn
Definition: GEM.H:301
unsigned int _ngtet
Definition: GEM.H:287
std::vector< unsigned int > _prisconn
Definition: GEM.H:299
unsigned int _ngpyr
Definition: GEM.H:289
unsigned int _nghex
Definition: GEM.H:288

Here is the call graph for this function:

Here is the caller graph for this function:

void Create_com_pconn ( std::vector< unsigned int >  rpids,
std::vector< std::vector< std::vector< unsigned int > > > &  index_vectors,
unsigned int &  nreal,
unsigned int &  ng,
std::vector< int > &  pc 
)

Definition at line 476 of file GEM.C.

References AddPconnSection(), and i.

481 {
482 
483  unsigned int section_size = 0;
484  unsigned int i = 0;
485  ng = 0;
486  if(index_vectors[i].size() == 0 && _out){
487  *_out
488  << "Roccom_create_pconn::Attempt to create empty pconn. Aborting.\n";
489  exit(1);
490  }
491  pc.resize(0);
492  AddPconnSection(rpids,index_vectors[i++],section_size,pc);
493  nreal = section_size;
494  while(i < 5 && index_vectors[i].size() != 0){
495  section_size = 0;
496  AddPconnSection(rpids,index_vectors[i++],section_size,pc);
497  ng += section_size;
498  }
499 }
std::ostream * _out
Definition: GEM.H:308
blockLoc i
Definition: read.cpp:79
void AddPconnSection(std::vector< unsigned int > rpids, std::vector< std::vector< unsigned int > > &indices, unsigned int &section_size, std::vector< int > &pconn)
Definition: GEM.C:441

Here is the call graph for this function:

void Create_com_volsoln ( const std::string &  fname,
std::vector< double > &  fvec,
unsigned int  ncomp,
const std::string &  unit 
)

Definition at line 413 of file GEM.C.

References COM_DOUBLE, COM_get_attribute_handle(), COM_new_attribute(), and COM_set_array().

Referenced by TRAIL_FluRegisterVolSoln().

416 {
417  string aname(volume_window+"."+fname);
418  int ahndl = COM_get_attribute_handle(aname);
419  if(ahndl<=0)
420  COM_new_attribute(aname,'e',COM_DOUBLE,ncomp,unit.c_str());
421  if(fvec.size() > 0)
422  COM_set_array(aname,pane_id,&fvec[0],ncomp);
423 }
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
int pane_id
Definition: GEM.H:315
void COM_set_array(const char *wa_str, int pane_id, void *addr, int strd=0, int cap=0)
Associates an array with an attribute for a specific pane.
Definition: roccom_c++.h:156
std::string volume_window
Definition: GEM.H:318
void COM_new_attribute(const char *wa_str, const char loc, const int type, int ncomp, const char *unit)
Registering an attribute type.
Definition: roccom_c++.h:118

Here is the call graph for this function:

Here is the caller graph for this function:

bool CreatePconn ( const std::string &  wname)

Definition at line 710 of file GEM.C.

References GEM_PartitionBoundary::_recvcells, GEM_PartitionBoundary::_recvnodes, GEM_PartitionBoundary::_rpart, GEM_PartitionBoundary::_sendcells, GEM_PartitionBoundary::_sendnodes, GEM_PartitionBoundary::_sharenodes, COM_set_array(), and COM_set_size().

711 {
712  if(_debug && _out)
713  *_out << "GEM_Partition(" << _id << ")::CreatePconn: enter" << endl;
714  pconn_nghost = 0;
715  unsigned int nrp = _pb.size(); // number of remote partitions
716  std::vector<unsigned int> rpid_v; // remote pane id's
717  std::vector<std::vector<std::vector<unsigned int> > > indices_v(5);
718  rpid_v.resize(nrp);
719  indices_v[0].resize(nrp); // shared nodes
720  indices_v[1].resize(nrp); // sent nodes
721  indices_v[2].resize(nrp); // recv nodes
722  indices_v[3].resize(nrp); // send elements
723  indices_v[4].resize(nrp); // recv elements
724  unsigned int rpin = 0;
725  while(rpin < nrp){
726  GEM_PartitionBoundary &fb = _pb[rpin];
727  unsigned int rpid = fb._rpart * 100 + 1;
728  rpid_v[rpin] = rpid;
729  indices_v[0][rpin] = fb._sharenodes;
730  indices_v[1][rpin] = fb._sendnodes;
731  indices_v[2][rpin] = fb._recvnodes;
732  indices_v[3][rpin] = fb._sendcells;
733  indices_v[4][rpin] = fb._recvcells;
734  rpin++;
735  }
736  unsigned int nreal = 0;
737  Create_com_pconn(rpid_v,indices_v,nreal,pconn_nghost,pconn);
738  assert(pconn.size() - pconn_nghost == nreal);
739  COM_set_size((wname+".pconn"),pane_id,pconn.size(),pconn_nghost);
740  COM_set_array((wname+".pconn"),pane_id,&pconn[0],1);
741  if(_debug && _out)
742  *_out << "GEM_Partition(" << _id << ")::CreatePconn: exit" << endl;
743  return(true);
744 }
void Create_com_pconn(std::vector< unsigned int > rpids, std::vector< std::vector< std::vector< unsigned int > > > &index_vectors, unsigned int &nreal, unsigned int &ng, std::vector< int > &pc)
Definition: GEM.C:476
std::vector< int > pconn
Definition: GEM.H:316
std::vector< unsigned int > _recvnodes
Definition: GEM.H:230
std::vector< unsigned int > _sendcells
Definition: GEM.H:227
void COM_set_size(const char *wa_str, int pane_id, int size, int ng=0)
Set sizes of for a specific attribute.
Definition: roccom_c++.h:136
std::vector< unsigned int > _sharenodes
Definition: GEM.H:231
std::vector< unsigned int > _recvcells
Definition: GEM.H:228
std::vector< unsigned int > _sendnodes
Definition: GEM.H:229
unsigned int pconn_nghost
Definition: GEM.H:317
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
int pane_id
Definition: GEM.H:315
std::vector< GEM_PartitionBoundary > _pb
Definition: GEM.H:304
void COM_set_array(const char *wa_str, int pane_id, void *addr, int strd=0, int cap=0)
Associates an array with an attribute for a specific pane.
Definition: roccom_c++.h:156
bool _debug
Definition: GEM.H:310
unsigned int _rpart
Definition: GEM.H:226

Here is the call graph for this function:

bool debug ( bool  s = true)

Definition at line 1266 of file GEM.C.

References s.

Referenced by main(), and TRAIL_Debug().

1267 {
1268  _debug = s;
1269  if(_debug && _out)
1270  *_out << "GEM_Partition(" << _id << ")::Debugging turned on\n";
1271  return(_debug);
1272 }
double s
Definition: blastest.C:80
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
bool _debug
Definition: GEM.H:310

Here is the caller graph for this function:

bool DestroyWindows ( )

Definition at line 584 of file GEM.C.

References COM_delete_window().

Referenced by main(), and TRAIL_RemeshWrite().

585 {
586  if(volume_window.empty() || surface_window.empty())
587  return(false);
590  // volume_window.erase();
591  // surface_window.erase();
592  return(true);
593 }
void COM_delete_window(const char *wname)
Definition: roccom_c++.h:94
std::string volume_window
Definition: GEM.H:318
std::string surface_window
Definition: GEM.H:319

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int Elem2Cell ( std::pair< unsigned int, unsigned int >  ti)

Definition at line 956 of file GEM.C.

References offset().

Referenced by PartitionBoundary::populate_local_arrays(), TRAIL_FluWriteCMP(), and TRAIL_GeoPartReadPartitionBoundaryASCII().

957 {
958  unsigned int elem_type = 0;
959  unsigned int offset = 0;
960  unsigned int nreal_elem;
961  while(elem_type < 4){
962  switch(_cell_ordering[elem_type]){
963  case 1:
964  nreal_elem = _tetconn.size()/4 - _ngtet;
965  if(ti.first != 1 || ti.second > nreal_elem)
966  offset += nreal_elem;
967  else{
968  return(offset+ti.second);
969  }
970  break;
971  case 2:
972  nreal_elem = _pyrconn.size()/5 - _ngpyr;
973  if(ti.first != 2 || ti.second > nreal_elem)
974  offset += nreal_elem;
975  else{
976  return(offset+ti.second);
977  }
978  break;
979  case 3:
980  nreal_elem = _prisconn.size()/6 - _ngpris;
981  if(ti.first != 3 || ti.second > nreal_elem)
982  offset += nreal_elem;
983  else{
984  return(offset+ti.second);
985  }
986  break;
987  case 4:
988  nreal_elem = _hexconn.size()/8 - _nghex;
989  if(ti.first != 4 || ti.second > nreal_elem)
990  offset += nreal_elem;
991  else{
992  return(offset+ti.second);
993  }
994  break;
995  }
996  elem_type++;
997  }
998  elem_type = 0;
999  while(elem_type < 4){
1000  switch(_cell_ordering[elem_type]){
1001  case 1:
1002  nreal_elem = _tetconn.size()/4 - _ngtet;
1003  if(ti.first != 1)
1004  offset += _ngtet;
1005  else{
1006  return(offset+ti.second-nreal_elem);
1007  }
1008  break;
1009  case 2:
1010  nreal_elem = _pyrconn.size()/5 - _ngpyr;
1011  if(ti.first != 2)
1012  offset += _ngpyr;
1013  else{
1014  return(offset+ti.second-nreal_elem);
1015  }
1016  break;
1017  case 3:
1018  nreal_elem = _prisconn.size()/6 - _ngpris;
1019  if(ti.first != 3)
1020  offset += _ngpris;
1021  else{
1022  return(offset+ti.second-nreal_elem);
1023  }
1024  break;
1025  case 4:
1026  nreal_elem = _hexconn.size()/8 - _nghex;
1027  if(ti.first != 4)
1028  offset += _nghex;
1029  else{
1030  return(offset+ti.second-nreal_elem);
1031  }
1032  break;
1033  }
1034  elem_type++;
1035  }
1036  if(_out)
1037  *_out << "GEM_Partition(" << _id
1038  << ")::Elem2Cell: Fatal error. Could not find element "
1039  << "(" << ti.first << "," << ti.second << "). Dying.\n";
1040  exit(1);
1041 }
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
real *8 function offset(vNorm, x2, y2, z2)
Definition: PlaneNorm.f90:211
unsigned int _cell_ordering[4]
Definition: GEM.H:303
unsigned int _ngpris
Definition: GEM.H:290
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
std::vector< unsigned int > _pyrconn
Definition: GEM.H:297
std::vector< unsigned int > _hexconn
Definition: GEM.H:301
unsigned int _ngtet
Definition: GEM.H:287
std::vector< unsigned int > _prisconn
Definition: GEM.H:299
unsigned int _ngpyr
Definition: GEM.H:289
unsigned int _nghex
Definition: GEM.H:288

Here is the call graph for this function:

Here is the caller graph for this function:

bool InitRoccomWindows ( const std::string &  wname)

Definition at line 685 of file GEM.C.

References COM_new_window().

Referenced by main(), and TRAIL_RemeshWrite().

686 {
687  if(_debug && _out)
688  *_out << "GEM_Partition(" << _id
689  << ")::InitRoccomWindows: Creating windows" << endl;
690  volume_window = wname+"_vol";
691  surface_window = wname+"_surf";
694  if(_debug && _out)
695  *_out << "GEM_Partition(" << _id
696  << ")::InitRoccomWindows: Populate Volume Window"
697  << endl;
699  return(false);
700  if(_debug && _out)
701  *_out << "GEM_Partition(" << _id
702  << ")::InitRoccomWindows: Populate Surface Window"
703  << endl;
705  return(false);
706  return(true);
707 }
bool PopulateSurfaceWindow(const std::string &wname)
Definition: GEM.C:819
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
void COM_new_window(const char *wname, MPI_Comm c=MPI_COMM_NULL)
Definition: roccom_c++.h:86
std::string volume_window
Definition: GEM.H:318
bool _debug
Definition: GEM.H:310
bool PopulateVolumeWindow(const std::string &wname)
Definition: GEM.C:747
std::string surface_window
Definition: GEM.H:319

Here is the call graph for this function:

Here is the caller graph for this function:

void MapDomainBoundaries ( std::map< unsigned int, unsigned int > &  bcmap)

Definition at line 1385 of file GEM.C.

References GEM_DomainBoundary::_id, GEM_DomainBoundary::_ngquad, GEM_DomainBoundary::_ngtri, GEM_DomainBoundary::_out, GEM_DomainBoundary::_quadconn, GEM_DomainBoundary::_triconn, and GEM_DomainBoundary::debug().

Referenced by FluRegion::PopulateFluPatches(), and TRAIL_FluPopulatePatches().

1386 {
1387  std::vector<GEM_DomainBoundary> indb(_db);
1388  std::vector<GEM_DomainBoundary> &outdb = _db;
1389  // Determine how many unique target BC's we have on this
1390  // source DB.
1391  list<unsigned int> local_patches;
1392  unsigned int partpatch = 0;
1393  unsigned int npartpatch = indb.size();
1394  while(partpatch < npartpatch)
1395  local_patches.push_back(bcmap[indb[partpatch++]._id]);
1396  local_patches.sort();
1397  local_patches.unique();
1398  unsigned int nlocal_patches = local_patches.size();
1399  if(_debug && _out){
1400  *_out << "GEM_Partition(" << _id
1401  << ")::MapDomainBoundaries: Local patches: " << endl
1402  << "GEM_Partition(" << _id << ")::MapDomainBoundaries: ";
1403  list<unsigned int>::iterator pli = local_patches.begin();
1404  while(pli != local_patches.end())
1405  *_out << *pli++ << " ";
1406  *_out << endl;
1407  }
1408  // resize the storage for the local db's to the number of unique
1409  // bc types on this partition
1410  outdb.resize(nlocal_patches);
1411  std::vector< list<unsigned int> > ppatch_list;
1412  ppatch_list.resize(nlocal_patches);
1413 
1414  // For every bc type on the source db, assign the target bc type to the
1415  // local storage array. Also construct an index mapping so we
1416  // can map bctype ----> local_patch_storage_array_index
1417  unsigned int local_patch = 0;
1418  list<unsigned int>::iterator li = local_patches.begin();
1419  while(li != local_patches.end()){
1420  GEM_DomainBoundary &fp = outdb[local_patch];
1421  fp._id = *li;
1422  fp._ngtri = 0;
1423  fp._ngquad = 0;
1424  if(_debug)
1425  fp.debug();
1426  unsigned int local_tri_size = 0;
1427  unsigned int local_quad_size = 0;
1428  // Now - loop through every source bc and find out which ones
1429  // contribute to this particular target bc so we can determine the total
1430  // size of the connectivities for pre-allocation.
1431  partpatch = 0;
1432  while(partpatch < npartpatch){
1433  const GEM_DomainBoundary &pp = indb[partpatch];
1434  unsigned int ggbpid = pp._id;
1435  unsigned int tdbid = bcmap[ggbpid];
1436  if(tdbid == *li){
1437  local_tri_size += pp._triconn.size()/3;
1438  fp._ngtri += pp._ngtri;
1439  local_quad_size += pp._quadconn.size()/4;
1440  fp._ngquad += pp._ngquad;
1441  ppatch_list[local_patch].push_back(partpatch);
1442  }
1443  partpatch++;
1444  }
1445  fp._triconn.resize(3*local_tri_size);
1446  fp._quadconn.resize(4*local_quad_size);
1447  li++;
1448  local_patch++;
1449  }
1450 
1451  // Step through all the target db's and check the list that tells us
1452  // which source db's to get our surface element connectivities from.
1453  // This is the second pass to actually populate the connectivities.
1454  local_patch = 0;
1455  while(local_patch < nlocal_patches){
1456  GEM_DomainBoundary &fp = outdb[local_patch];
1457  fp._out = indb[0]._out;
1458  unsigned int tri = 0;
1459  unsigned int gtri = 0;
1460  unsigned int quad = 0;
1461  unsigned int gquad = 0;
1462  unsigned int realtri = fp._triconn.size()/3 - fp._ngtri;
1463  unsigned int realquads = fp._quadconn.size()/4 - fp._ngquad;
1464  li = ppatch_list[local_patch].begin();
1465  while(li != ppatch_list[local_patch].end()){
1466  const GEM_DomainBoundary &pp = indb[*li++];
1467  unsigned int pptri = 0;
1468  unsigned int ppquad = 0;
1469  unsigned int ntri = pp._triconn.size()/3;
1470  unsigned int nrealtri = ntri - pp._ngtri;
1471  unsigned int nquad = pp._quadconn.size()/4;
1472  unsigned int nrealquad = nquad - pp._ngquad;
1473  while(ppquad < nquad){
1474  if(ppquad < nrealquad){
1475  fp._quadconn[4*quad] = pp._quadconn[4*ppquad];
1476  fp._quadconn[4*quad+1] = pp._quadconn[4*ppquad+1];
1477  fp._quadconn[4*quad+2] = pp._quadconn[4*ppquad+2];
1478  fp._quadconn[4*quad+3] = pp._quadconn[4*ppquad+3];
1479  quad++;
1480  ppquad++;
1481  }
1482  else{
1483  fp._quadconn[(4*realquads)+(4*gquad)] = pp._quadconn[4*ppquad];
1484  fp._quadconn[(4*realquads)+(4*gquad)+1] = pp._quadconn[4*ppquad+1];
1485  fp._quadconn[(4*realquads)+(4*gquad)+2] = pp._quadconn[4*ppquad+2];
1486  fp._quadconn[(4*realquads)+(4*gquad)+3] = pp._quadconn[4*ppquad+3];
1487  gquad++;
1488  ppquad++;
1489  }
1490  }
1491  while(pptri < ntri){
1492  if(pptri < nrealtri){
1493  fp._triconn[3*tri] = pp._triconn[3*pptri];
1494  fp._triconn[3*tri+1] = pp._triconn[3*pptri+1];
1495  fp._triconn[3*tri+2] = pp._triconn[3*pptri+2];
1496  tri++;
1497  pptri++;
1498  }
1499  else{
1500  fp._triconn[(3*realtri)+(3*gtri)] = pp._triconn[3*pptri];
1501  fp._triconn[(3*realtri)+(3*gtri)+1] = pp._triconn[3*pptri+1];
1502  fp._triconn[(3*realtri)+(3*gtri)+2] = pp._triconn[3*pptri+2];
1503  gtri++;
1504  pptri++;
1505  }
1506  }
1507  }
1508  local_patch++;
1509  }
1510  return;
1511 }
std::vector< unsigned int > _quadconn
Definition: GEM.H:132
unsigned int _id
Definition: GEM.H:127
std::vector< unsigned int > _triconn
Definition: GEM.H:131
unsigned int _id
Definition: GEM.H:284
std::vector< GEM_DomainBoundary > _db
Definition: GEM.H:305
std::ostream * _out
Definition: GEM.H:308
unsigned int _ngquad
Definition: GEM.H:129
bool _debug
Definition: GEM.H:310
bool debug(bool s=true)
Definition: GEM.H:193
std::ostream * _out
Definition: GEM.H:140
unsigned int _ngtri
Definition: GEM.H:128

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int nelem ( )
inline

Definition at line 366 of file GEM.H.

References _hexconn, _prisconn, _pyrconn, and _tetconn.

367  {
368  return(_tetconn.size()/4+_pyrconn.size()/5+
369  _prisconn.size()/6+_hexconn.size()/8);
370  };
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
std::vector< unsigned int > _pyrconn
Definition: GEM.H:297
std::vector< unsigned int > _hexconn
Definition: GEM.H:301
std::vector< unsigned int > _prisconn
Definition: GEM.H:299
GEM_Partition& operator= ( const GEM_Partition gp)
inline

Definition at line 491 of file GEM.H.

References _cell_ordering, _comm, _debug, _hexconn, _id, _nc, _nghex, _ngnodes, _ngpris, _ngpyr, _ngtet, _nvface, _out, _prisconn, _pyrconn, and _tetconn.

492  {
493  _id = gp._id;
494  _out = gp._out;
495  _ngnodes = gp._ngnodes;
496  _ngtet = gp._ngtet;
497  _nghex = gp._nghex;
498  _ngpyr = gp._ngpyr;
499  _ngpris = gp._ngpris;
500  _nc = gp._nc;
501  _nvface = gp._nvface;
502  _tetconn = gp._tetconn;
503  _pyrconn = gp._pyrconn;
504  _prisconn = gp._prisconn;
505  _hexconn = gp._hexconn;
506  _debug = gp._debug;
507  //#ifdef _TRAIL_MPI_
508  _comm = gp._comm;
509  //#endif
510  _cell_ordering[0] = gp._cell_ordering[0];
511  _cell_ordering[1] = gp._cell_ordering[1];
512  _cell_ordering[2] = gp._cell_ordering[2];
513  _cell_ordering[3] = gp._cell_ordering[3];
514  return(*this);
515  };
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
unsigned int _ngnodes
Definition: GEM.H:286
unsigned int _cell_ordering[4]
Definition: GEM.H:303
unsigned int _ngpris
Definition: GEM.H:290
unsigned int _nvface
Definition: GEM.H:291
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
std::vector< unsigned int > _pyrconn
Definition: GEM.H:297
std::vector< unsigned int > _hexconn
Definition: GEM.H:301
MPI_Comm _comm
Definition: GEM.H:312
bool _debug
Definition: GEM.H:310
unsigned int _ngtet
Definition: GEM.H:287
std::vector< double > _nc
Definition: GEM.H:293
std::vector< unsigned int > _prisconn
Definition: GEM.H:299
unsigned int _ngpyr
Definition: GEM.H:289
unsigned int _nghex
Definition: GEM.H:288
bool PopulatePartitionBoundaries ( std::vector< GEM_PartitionBoundary > &  pb)

Definition at line 1358 of file GEM.C.

1360 {
1361  unsigned int nborders = pb.size();
1362  _pb.resize(nborders);
1363  // if(_solver_data._int_data.empty())
1364  // _solver_data._int_data.resize(2);
1365  // _solver_data._int_data[0].resize(nborders);
1366  unsigned int border = 0;
1367  while(border < nborders){
1368  _pb[border]._rpart = pb[border]._rpart;
1369  _pb[border]._sendcells = pb[border]._sendcells;
1370  _pb[border]._recvcells = pb[border]._recvcells;
1371  _pb[border]._sharenodes = pb[border]._sharenodes;
1372  _pb[border]._sendnodes = pb[border]._sendnodes;
1373  _pb[border]._recvnodes = pb[border]._recvnodes;
1374  // _pb[border]._rbid = pb[border]._rbid;
1375  _pb[border]._out = pb[border]._out;
1376  border++;
1377  }
1378  return(true);
1379 }
std::vector< GEM_PartitionBoundary > _pb
Definition: GEM.H:304
bool PopulateSurfaceWindow ( const std::string &  wname)

Definition at line 819 of file GEM.C.

References GEM_DomainBoundary::pane_id, GEM_DomainBoundary::PopulateSurfaceArrays(), and GEM_DomainBoundary::Register_com_surfmesh().

820 {
821  if(_debug && _out)
822  *_out << "GEM_Partition(" << _id
823  << ")::PopulateSurfaceWindow: enter" << endl;
824  // For each domain boundary
825  int npatches = _db.size();
826  int patch = 0;
827  while(patch < npatches){
828  GEM_DomainBoundary &fp = _db[patch];
829  fp.pane_id = _id * 100 + (patch+1) + 1;
831  fp.Register_com_surfmesh(wname);
832  patch++;
833  }
834  if(_debug && _out)
835  *_out << "GEM_Partition(" << _id
836  << ")::PopulateSurfaceWindow: exit" << endl;
837  return(true);
838 }
unsigned int _ngnodes
Definition: GEM.H:286
Definition: patch.h:74
unsigned int _id
Definition: GEM.H:284
std::vector< GEM_DomainBoundary > _db
Definition: GEM.H:305
std::ostream * _out
Definition: GEM.H:308
bool Register_com_surfmesh(const std::string &wname)
Definition: GEM.C:545
bool _debug
Definition: GEM.H:310
std::vector< double > _nc
Definition: GEM.H:293
void PopulateSurfaceArrays(const std::vector< double > &, unsigned int)
Definition: GEM.C:233

Here is the call graph for this function:

bool PopulateVolumeWindow ( const std::string &  wname)

Definition at line 747 of file GEM.C.

References COM_set_array(), and COM_set_size().

Referenced by TRAIL_RocmopSmooth().

748 {
749  if(_debug && _out)
750  *_out << "GEM_Partition(" << _id
751  << ")::PopulateVolumeWindow: enter" << endl;
752  pane_id = _id * 100 + 1;
753  // Set the volume mesh entity sizes and register the arrays
754  unsigned int nnodes = _nc.size()/3;
755  COM_set_size((wname+".nc"),pane_id,nnodes,_ngnodes);
756  COM_set_array((wname+".nc"),pane_id,&_nc[0],3);
757  unsigned int el_type = 0;
758  while(el_type < 4){
759  unsigned int nreal;
760  switch(_cell_ordering[el_type]){
761  case 1:
762  nreal = _tetconn.size()/4 - _ngtet;
763  if(nreal > 0)
764  Register_com_volconn(wname,pane_id,nreal,_ngtet,_tetconn,4,false);
765  break;
766  case 2:
767  nreal = _pyrconn.size()/5 - _ngpyr;
768  if(nreal > 0)
769  Register_com_volconn(wname,pane_id,nreal,_ngpyr,_pyrconn,5,false);
770  break;
771  case 3:
772  nreal = _prisconn.size()/6 - _ngpris;
773  if(nreal > 0)
774  Register_com_volconn(wname,pane_id,nreal,_ngpris,_prisconn,6,false);
775  break;
776  case 4:
777  nreal = _hexconn.size()/8 - _nghex;
778  if(nreal > 0)
779  Register_com_volconn(wname,pane_id,nreal,_nghex,_hexconn,8,false);
780  break;
781  }
782  el_type++;
783  }
784  el_type = 0;
785  while(el_type < 4){
786  unsigned int nreal;
787  switch(_cell_ordering[el_type]){
788  case 1:
789  nreal = _tetconn.size()/4 - _ngtet;
790  if(_ngtet > 0)
792  break;
793  case 2:
794  nreal = _pyrconn.size()/5 - _ngpyr;
795  if(_ngpyr > 0)
797  break;
798  case 3:
799  nreal = _prisconn.size()/6 - _ngpris;
800  if(_ngpris > 0)
802  break;
803  case 4:
804  nreal = _hexconn.size()/8 - _nghex;
805  if(_nghex > 0)
807  break;
808  }
809  el_type++;
810  }
811  CreatePconn(wname);
812  if(_debug && _out)
813  *_out << "GEM_Partition(" << _id
814  << ")::PopulateVolumeWindow: exit" << endl;
815  return(true);
816 }
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
void COM_set_size(const char *wa_str, int pane_id, int size, int ng=0)
Set sizes of for a specific attribute.
Definition: roccom_c++.h:136
unsigned int _ngnodes
Definition: GEM.H:286
unsigned int _cell_ordering[4]
Definition: GEM.H:303
unsigned int _ngpris
Definition: GEM.H:290
bool CreatePconn(const std::string &wname)
Definition: GEM.C:710
void Register_com_volconn(const std::string &wname, int paneid, unsigned int nel, unsigned int ngel, std::vector< unsigned int > &conn, unsigned int esize, bool ghost_part=false)
Definition: GEM.C:503
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
int pane_id
Definition: GEM.H:315
std::vector< unsigned int > _pyrconn
Definition: GEM.H:297
std::vector< unsigned int > _hexconn
Definition: GEM.H:301
void COM_set_array(const char *wa_str, int pane_id, void *addr, int strd=0, int cap=0)
Associates an array with an attribute for a specific pane.
Definition: roccom_c++.h:156
bool _debug
Definition: GEM.H:310
unsigned int _ngtet
Definition: GEM.H:287
std::vector< double > _nc
Definition: GEM.H:293
std::vector< unsigned int > _prisconn
Definition: GEM.H:299
unsigned int _ngpyr
Definition: GEM.H:289
unsigned int _nghex
Definition: GEM.H:288

Here is the call graph for this function:

Here is the caller graph for this function:

bool ReadRocstar ( const std::string &  prefix,
double  t = 0.0 
)

Definition at line 595 of file GEM.C.

596 {
597  return(false);
598 }
void Register_com_volconn ( const std::string &  wname,
int  paneid,
unsigned int  nel,
unsigned int  ngel,
std::vector< unsigned int > &  conn,
unsigned int  esize,
bool  ghost_part = false 
)

Definition at line 503 of file GEM.C.

References COM_set_array(), and COM_set_size().

507 {
508  if(nel == 0 || esize == 0) return;
509  unsigned int nreal = conn.size()/esize - ngel;
510  string mesh_type;
511  switch(esize){
512  case 4: // Tets
513  mesh_type = ":T4";
514  break;
515  case 5:
516  mesh_type = ":P5";
517  break;
518  case 6:
519  mesh_type = ":P6";
520  break;
521  case 8:
522  mesh_type = ":H8";
523  break;
524  default:
525  if(_out)
526  *_out << "Roccom_register_mesh::Error: Unknown mesh type, aborting.\n";
527  exit(1);
528  }
529  mesh_type = wname + "." + mesh_type + ":";
530  string entity;
531  if(nreal > 0 && !ghost_part){
532  entity = mesh_type + "real";
533  COM_set_size(entity,paneid,nreal);
534  COM_set_array(entity,paneid,&(conn[0]),esize);
535  }
536  if(ngel > 0 && ghost_part){
537  entity = mesh_type + "virtual";
538  COM_set_size(entity,paneid,ngel,ngel);
539  COM_set_array(entity,paneid,&(conn[nreal*esize]),esize);
540  }
541 }
void COM_set_size(const char *wa_str, int pane_id, int size, int ng=0)
Set sizes of for a specific attribute.
Definition: roccom_c++.h:136
std::ostream * _out
Definition: GEM.H:308
void COM_set_array(const char *wa_str, int pane_id, void *addr, int strd=0, int cap=0)
Associates an array with an attribute for a specific pane.
Definition: roccom_c++.h:156

Here is the call graph for this function:

void report ( )

Definition at line 49 of file GEM.C.

Referenced by main().

50 {
51  if(_out){
52  *_out << "GEM_Partition ID: " << _id << endl
53  << "Mesh Entities: Total Real Ghosts" << endl
54  << "Number of Nodes: (" << _nc.size()/3 << ","
55  << _nc.size()/3 - _ngnodes << "," << _ngnodes << ")"
56  << endl
57  << "Number of Elements: (" << nelem() << ","
58  << nelem() - _ngtet - _ngpyr - _ngpris - _nghex << ","
59  << _ngtet + _ngpyr + _ngpris + _nghex << ")" << endl
60  << "Cell Mapping: (" << _cell_ordering[0] << ","
61  << _cell_ordering[1] << "," << _cell_ordering[2] << ","
62  << _cell_ordering[3] << ")" << endl;
63  if(_tetconn.size() > 0)
64  *_out << "Tets: (" << _tetconn.size()/4 << ","
65  << _tetconn.size()/4 - _ngtet << "," << _ngtet << ")" << endl;
66  if(_pyrconn.size() > 0)
67  *_out << "Pyramids: (" << _pyrconn.size()/5 << ","
68  << _pyrconn.size()/5 - _ngpyr << "," << _ngpyr << ")" << endl;
69  if(_prisconn.size() > 0)
70  *_out << "Prisms: (" << _prisconn.size()/6 << ","
71  << _prisconn.size()/6 - _ngpris << "," << _ngpris << ")" << endl;
72  if(_hexconn.size() > 0)
73  *_out << "Hexes: (" << _hexconn.size()/8 << ","
74  << _hexconn.size()/8 - _nghex << "," << _nghex << ")" << endl;
75  if(_debug){
76  debug(false);
77  *_out << "Cell debugging: " << endl;
78  unsigned int nel,el;
79  unsigned int nlin = 5;
80  if(_tetconn.size() > 0) {
81  *_out << "Tet Cell IDs: " << endl;
82  nel = _tetconn.size()/4;
83  nlin = 5;
84  el = 0;
85  while(el < nel){
86  *_out << setw(12) << Elem2Cell(std::make_pair((unsigned int)1,++el));
87  if(!(el%nlin))
88  *_out << endl;
89  }
90  if(el%nlin) *_out << endl;
91  }
92  if(_pyrconn.size() > 0){
93  *_out << "Pyr Cell IDs: " << endl;
94  nel = _pyrconn.size()/5;
95  el = 0;
96  while(el < nel){
97  *_out << setw(12) << Elem2Cell(std::make_pair((unsigned int)2,++el));
98  if(!(el%nlin))
99  *_out << endl;
100  }
101  if(el%nlin) *_out << endl;
102  }
103  if(_prisconn.size() > 0){
104  *_out << "Pris Cell IDs:" << endl;
105  nel = _prisconn.size()/6;
106  el = 0;
107  while(el < nel){
108  *_out << setw(12) << Elem2Cell(std::make_pair((unsigned int)3,++el));
109  if(!(el%nlin))
110  *_out << endl;
111  }
112  if(el%nlin) *_out << endl;
113  }
114  if(_hexconn.size() > 0){
115  *_out << "Hex Cell IDs: " << endl;
116  nel = _hexconn.size()/8;
117  el = 0;
118  while(el < nel){
119  *_out << setw(12) << Elem2Cell(std::make_pair((unsigned int)4,++el));
120  if(!(el%nlin))
121  *_out << endl;
122  }
123  if(el%nlin) *_out << endl;
124  }
125  debug(true);
126  }
127  }
128 }
unsigned int nelem()
Definition: GEM.H:366
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
unsigned int _ngnodes
Definition: GEM.H:286
unsigned int _cell_ordering[4]
Definition: GEM.H:303
unsigned int _ngpris
Definition: GEM.H:290
unsigned int Elem2Cell(std::pair< unsigned int, unsigned int >)
Definition: GEM.C:956
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
std::vector< unsigned int > _pyrconn
Definition: GEM.H:297
std::vector< unsigned int > _hexconn
Definition: GEM.H:301
bool debug(bool s=true)
Definition: GEM.C:1266
bool _debug
Definition: GEM.H:310
unsigned int _ngtet
Definition: GEM.H:287
std::vector< double > _nc
Definition: GEM.H:293
std::vector< unsigned int > _prisconn
Definition: GEM.H:299
unsigned int _ngpyr
Definition: GEM.H:289
unsigned int _nghex
Definition: GEM.H:288

Here is the caller graph for this function:

void report_domain_boundaries ( )

Definition at line 163 of file GEM.C.

References GEM_DomainBoundary::report().

164 {
165  if(_out){
166  *_out << "==================================================" << endl
167  << "Number of Domain Boundaries: " << _db.size() << endl;
168  unsigned int patch = 0;
169  while(patch < _db.size()){
170  GEM_DomainBoundary &fp = _db[patch++];
171  *_out << "------------------------------------------------" << endl;
172  fp.report();
173  *_out << "------------------------------------------------" << endl;
174  }
175  *_out << "==================================================" << endl;
176  }
177 }
Definition: patch.h:74
std::vector< GEM_DomainBoundary > _db
Definition: GEM.H:305
std::ostream * _out
Definition: GEM.H:308
void report()
Definition: GEM.C:181

Here is the call graph for this function:

void report_partition_boundaries ( )

Definition at line 131 of file GEM.C.

References GEM_PartitionBoundary::report().

132 {
133  if(_out){
134  *_out << "==================================================" << endl
135  << "Number of partition boundaries: " << _pb.size() << endl;
136  unsigned int border = 0;
137  while(border < _pb.size()){
138  GEM_PartitionBoundary &fb = _pb[border++];
139  *_out << "------------------------------------------------" << endl
140  << " Partition Boundary #" << border+1 << endl;
141  fb.report();
142  *_out << "------------------------------------------------" << endl;
143  }
144  *_out << "==================================================" << endl;
145  }
146 }
std::ostream * _out
Definition: GEM.H:308
std::vector< GEM_PartitionBoundary > _pb
Definition: GEM.H:304

Here is the call graph for this function:

void ResolveCellMapping ( GEM_Partition sp)

Definition at line 1524 of file GEM.C.

References GEM_PartitionBoundary::_recvcells, GEM_PartitionBoundary::_sendcells, and Cell2Elem().

1525 {
1526  if(_debug && _out)
1527  *_out << "GEM_Partition::ResolveCellMapping: enter";
1528  unsigned int npb = _pb.size();
1529  unsigned int p = 0;
1530  while(p < npb){
1531  GEM_PartitionBoundary &pbi = _pb[p++];
1532  unsigned int nsend = pbi._sendcells.size();
1533  unsigned int cell = 0;
1534  while(cell < nsend){
1535  pbi._sendcells[cell] = Elem2Cell(sp.Cell2Elem(pbi._sendcells[cell]));
1536  cell++;
1537  }
1538  unsigned int nrecv = pbi._recvcells.size();
1539  cell = 0;
1540  while(cell < nrecv){
1541  pbi._recvcells[cell] = Elem2Cell(sp.Cell2Elem(pbi._recvcells[cell]));
1542  cell++;
1543  }
1544  }
1545  if(_debug && _out)
1546  *_out << "GEM_Partition(" << _id << ")::ResolveCellMapping: exit";
1547 }
std::vector< unsigned int > _sendcells
Definition: GEM.H:227
std::vector< unsigned int > _recvcells
Definition: GEM.H:228
unsigned int Elem2Cell(std::pair< unsigned int, unsigned int >)
Definition: GEM.C:956
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
std::vector< GEM_PartitionBoundary > _pb
Definition: GEM.H:304
std::pair< unsigned int, unsigned int > Cell2Elem(unsigned int)
Definition: GEM.C:875
bool _debug
Definition: GEM.H:310

Here is the call graph for this function:

void SetNodalCoordinates ( double *  data,
int  nn,
int  ng 
)

Definition at line 1276 of file GEM.C.

1277 {
1278  if(_debug && _out){
1279  ostringstream Ostr;
1280  Ostr << "GEM_Partition(" << _id << ")::SetNodalCoordinates "
1281  << " total nodes = " << nn << ", " << ng << " ghosts.\n";
1282  *_out << Ostr.str();
1283  }
1284  assert(nn >= ng);
1285  _ngnodes = ng;
1286  _nc.resize(3*nn);
1287  memcpy((void *)&_nc[0],(void *)data,3*nn*sizeof(double));
1288 }
unsigned int _ngnodes
Definition: GEM.H:286
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
bool _debug
Definition: GEM.H:310
std::vector< double > _nc
Definition: GEM.H:293
bool SetSolverDataBlock ( const std::string &  wname,
double *  cell_data,
int  nval_cells,
double *  node_data,
int  nval_nodes 
)

Definition at line 1045 of file GEM.C.

1048 {
1049  _solver_data._string_data.push_back(wname);
1050  _solver_data._field_data.resize(2);
1051  unsigned int ncells = _tetconn.size()/4 + _hexconn.size()/8 +
1052  _prisconn.size()/6 + _pyrconn.size()/5;
1053  unsigned int nnodes = _nc.size()/3;
1054  if(_debug && _out)
1055  *_out << "GEM_Partition(" << _id << ")::SetSolverDataBlock: "
1056  << "Receiving data for " << nval_cells << " doubles on " << ncells
1057  << " cells and " << nval_nodes << " doubles on " << nnodes
1058  << " nodes." << std::endl;
1059  _solver_data._field_data[0].resize(nval_cells*ncells);
1060  _solver_data._field_data[1].resize(nval_nodes*nnodes);
1061  _solver_data._stride_field.resize(2);
1062  _solver_data._stride_field[0] = nval_cells;
1063  _solver_data._stride_field[1] = nval_nodes;
1064  memcpy(&_solver_data._field_data[0][0],cell_data,
1065  sizeof(double)*nval_cells*ncells);
1066  memcpy(&_solver_data._field_data[1][0],node_data,
1067  sizeof(double)*nval_nodes*nnodes);
1068  return(true);
1069 }
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
std::vector< std::string > _string_data
Definition: GEM.H:105
std::vector< std::vector< double > > _field_data
Definition: GEM.H:95
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
std::vector< unsigned int > _pyrconn
Definition: GEM.H:297
std::vector< unsigned int > _hexconn
Definition: GEM.H:301
std::vector< int > _stride_field
Definition: GEM.H:103
bool _debug
Definition: GEM.H:310
GEM_UserData _solver_data
Definition: GEM.H:307
std::vector< double > _nc
Definition: GEM.H:293
std::vector< unsigned int > _prisconn
Definition: GEM.H:299
void SetVolumeElements ( int *  data,
int  ncells,
int  ng,
int  npe 
)

Definition at line 1291 of file GEM.C.

1292 {
1293  if(_debug && _out){
1294  *_out << "GEM_Partition(" << _id << ")::SetVolumeElements "
1295  << " total cells = " << ncells << " of size " << npe
1296  << " of which " << ng << " are ghosts." << endl;
1297  }
1298  unsigned int datasize = ncells*npe*sizeof(int);
1299  assert(ncells >= ng);
1300  int ndatp = npe*ncells;
1301  for(int ndat =0;ndat < ndatp;ndat++)
1302  assert(data[ndat] != 0);
1303  void *dest;
1304  switch(npe){
1305  case 4:
1306  _tetconn.resize(4*ncells);
1307  dest = &_tetconn[0];
1308  _ngtet = ng;
1309  break;
1310  case 5:
1311  _pyrconn.resize(5*ncells);
1312  dest = &_pyrconn[0];
1313  _ngpyr = ng;
1314  break;
1315  case 6:
1316  _prisconn.resize(6*ncells);
1317  dest = &_prisconn[0];
1318  _ngpris = ng;
1319  break;
1320  case 8:
1321  _hexconn.resize(8*ncells);
1322  dest = &_hexconn[0];
1323  _nghex = ng;
1324  break;
1325  default:
1326  if(_out)
1327  *_out << "GEM_Partition::Unknown volume element type. Aborting."
1328  << endl;
1329  exit(1);
1330  }
1331  memcpy(dest,data,datasize);
1332 }
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
unsigned int _ngpris
Definition: GEM.H:290
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
std::vector< unsigned int > _pyrconn
Definition: GEM.H:297
std::vector< unsigned int > _hexconn
Definition: GEM.H:301
bool _debug
Definition: GEM.H:310
unsigned int _ngtet
Definition: GEM.H:287
std::vector< unsigned int > _prisconn
Definition: GEM.H:299
unsigned int _ngpyr
Definition: GEM.H:289
unsigned int _nghex
Definition: GEM.H:288
bool validate_comm_list ( int  ncsend,
int  ncrecv,
int *  csend,
int *  crecv 
)

Definition at line 1149 of file GEM.C.

1150 {
1151  int index = 0;
1152  int nreal_cell = _tetconn.size()/4 + _prisconn.size()/6 +
1153  _pyrconn.size()/5 + _hexconn.size()/8 - (_ngtet + _ngpris +
1154  _ngpyr + _nghex);
1155  bool rval = true;
1156  while(index < ncsend){
1157  int ind = index++;
1158  if(!(csend[ind] <= nreal_cell)){
1159  if(_out)
1160  *_out << "SEND CELL " << index << " is a ghost cell!!" << endl;
1161  rval = false;
1162  }
1163  if(!(csend[ind] > 0)){
1164  if(_out)
1165  *_out << "SEND CELL " << index << " is zero or negative!" << endl;
1166  rval = false;
1167  }
1168  }
1169  index = 0;
1170  list<int> recvcell_list;
1171  while(index < ncrecv) {
1172  int ind = index++;
1173  if(!(crecv[ind] > nreal_cell)){
1174  if(_out)
1175  *_out << "RECV CELL " << index << " is a real cell!!" << endl;
1176  rval = false;
1177  }
1178  if(!(crecv[ind] > 0)){
1179  if(_out)
1180  *_out << "RECV CELL " << index << " is zero or negative!" << endl;
1181  rval = false;
1182  }
1183  bool duped = false;
1184  list<int>::iterator rci = recvcell_list.begin();
1185  while(rci != recvcell_list.end() && !duped){
1186  if(crecv[ind] == *rci++){
1187  if(_out)
1188  *_out << "RECV CELL " << index
1189  << " is duplicated in the receive list!"
1190  << endl;
1191  duped = true;
1192  }
1193  }
1194  if(!duped)
1195  recvcell_list.push_back(crecv[ind]);
1196  }
1197  return(rval);
1198 }
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
unsigned int _ngpris
Definition: GEM.H:290
std::ostream * _out
Definition: GEM.H:308
std::vector< unsigned int > _pyrconn
Definition: GEM.H:297
std::vector< unsigned int > _hexconn
Definition: GEM.H:301
unsigned int _ngtet
Definition: GEM.H:287
std::vector< unsigned int > _prisconn
Definition: GEM.H:299
unsigned int _ngpyr
Definition: GEM.H:289
unsigned int _nghex
Definition: GEM.H:288
bool ValidateMesh ( )
bool WindowInitDone ( )

Definition at line 575 of file GEM.C.

References COM_window_init_done().

Referenced by main(), and TRAIL_RemeshWrite().

576 {
577  if(volume_window.empty() || surface_window.empty())
578  return(false);
581  return(true);
582 }
void COM_window_init_done(const char *w_str, int pane_changed=true)
Definition: roccom_c++.h:102
std::string volume_window
Definition: GEM.H:318
std::string surface_window
Definition: GEM.H:319

Here is the call graph for this function:

Here is the caller graph for this function:

bool WriteRocstar ( const std::string &  prefix,
double  t = 0.0 
)

Definition at line 601 of file GEM.C.

References TRAIL_CWD(), and TRAIL_WriteWindow().

Referenced by main(), and TRAIL_RemeshWrite().

602 {
603  string pre(prefix);
604  if(pre.empty())
605  pre = ".";
606  if(volume_window.empty() || surface_window.empty())
607  return false;
608  if(_debug && _out)
609  *_out << "GEM_Partition(" << _id << ")::WriteRocstar: Writing volume window"
610  << " in " << prefix << ". CWD = " << TRAIL_CWD() << std::endl;
612  return false;
613 // COM_LOAD_MODULE_STATIC_DYNAMIC(Rocout,"Rocout");
614 // int OUT_set_option = COM_get_function_handle( "Rocout.set_option");
615 // string rankstr("0");
616 // COM_call_function( OUT_set_option, "rankwidth", rankstr.c_str());
617 
618 // // Build a filename and write the volume window
619 // string timestring(TRAIL_TimeString(t));
620 // ostringstream Ostr;
621 // Ostr << pre << "/" << volume_window << "_"
622 // << timestring << "_" << setw(5) << setfill('0')
623 // << _id;
624 // int whand = COM_get_function_handle("Rocout.write_attribute");
625 // int all = COM_get_attribute_handle((volume_window+".all"));
626 // if(_debug && _out)
627 // *_out << "GEM_Partition(" << _id
628 // << ")::WriteRocstar: Writing volume window\n";
629 // COM_call_function(whand,Ostr.str().c_str(),&all,volume_window.c_str(),
630 // timestring.c_str());
631 // // Write Rocin control file
632 // std::vector<int> pane_ids;
633 // string controlfilename;
634 // COM_get_panes(volume_window.c_str(),pane_ids);
635 // ofstream Ouf;
636 // controlfilename = Ostr.str() + "_in.txt";
637 // Ouf.open(controlfilename.c_str());
638 // Ouf << "@Proc: " << _id - 1 << endl
639 // << "@Files: " << volume_window << "_" << timestring << "_"
640 // << setw(5) << setfill('0') << _id << ".hdf" << endl;
641 // Ouf.clear();
642 // Ouf << "@Panes: " << pane_ids[0] << endl;
643 // Ouf.close();
644 
645 // Ostr.clear();
646 // pane_ids.resize(0);
647 // Ostr.str("");
648 // Ostr << pre << "/" << surface_window << "_"
649 // << timestring << "_" << setw(5) << setfill('0')
650 // << _id;
651  if(_debug && _out)
652  *_out << "GEM_Partition(" << _id
653  << ")::WriteRocstar: Writing surface window\n";
655  return false;
656 // all = COM_get_attribute_handle((surface_window+".all"));
657 // COM_call_function(whand,Ostr.str().c_str(),&all,surface_window.c_str(),
658 // timestring.c_str());
659 // // Write Rocin control file
660 // controlfilename = Ostr.str() + "_in.txt";
661 // COM_get_panes(surface_window.c_str(),pane_ids);
662 // Ouf.open(controlfilename.c_str());
663 // Ouf << "@Proc: " << _id - 1 << endl
664 // << "@Files: " << surface_window << "_" << timestring << "_"
665 // << setw(5) << setfill('0') << _id << ".hdf" << endl;
666 // Ouf.clear();
667 // Ouf << "@Panes: ";
668 // std::vector<int>::iterator pii = pane_ids.begin();
669 // while(pii != pane_ids.end())
670 // Ouf << *pii++ << " ";
671 // Ouf << endl;
672 // Ouf.close();
673 // if(_debug && _out)
674 // *_out << "GEM_Partition(" << _id << ")::WriteRocstar: Unloading Rocout\n";
675 // COM_UNLOAD_MODULE_STATIC_DYNAMIC(Rocout,"Rocout");
676 
677  return(true);
678 }
bool TRAIL_WriteWindow(const std::string &wname, const std::string &path, const std::string &twin, const std::string &tpath, double t, unsigned int id, MPI_Comm comm, std::ostream *=NULL)
Definition: TRAIL.C:2811
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
std::string TRAIL_CWD(void)
std::string volume_window
Definition: GEM.H:318
MPI_Comm _comm
Definition: GEM.H:312
bool _debug
Definition: GEM.H:310
std::string surface_window
Definition: GEM.H:319

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

unsigned int _cell_ordering[4]

Definition at line 303 of file GEM.H.

Referenced by FluRegion::FluRegion(), GEM_Partition(), main(), and operator=().

MPI_Comm _comm

Definition at line 312 of file GEM.H.

Referenced by GEM_Partition(), main(), operator=(), TRAIL_Debug(), and TRAIL_RocmopSmooth().

unsigned int _ngnodes
unsigned int _npart

Definition at line 285 of file GEM.H.

Referenced by main(), TRAIL_AutoSurfer(), TRAIL_RemeshFixRocstarFiles(), and TRAIL_RemeshWrite().

unsigned int _nvface
int pane_id

Definition at line 315 of file GEM.H.

Referenced by TRAIL_FluRegisterVolSoln(), and TRAIL_RocmopSmooth().

std::vector<int> pconn

Definition at line 316 of file GEM.H.

unsigned int pconn_nghost

Definition at line 317 of file GEM.H.

std::string volume_window

Definition at line 318 of file GEM.H.

Referenced by TRAIL_FluRegisterVolSoln(), and TRAIL_RemeshFixRocstarFiles().


The documentation for this class was generated from the following files: