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

#include <GEM.H>

Inheritance diagram for GEM_DomainBoundary:
Collaboration diagram for GEM_DomainBoundary:

Public Member Functions

unsigned int NNodes (void)
 
bool SetSolverDataBlock (const std::string &wname, double *cell_data, int nval_cells, double *node_data, int nval_nodes)
 
 GEM_DomainBoundary (const GEM_DomainBoundary &db)
 
 GEM_DomainBoundary ()
 
GEM_DomainBoundaryoperator= (const GEM_DomainBoundary &db)
 
bool debug (bool s=true)
 
void report ()
 
void PopulateSurfaceArrays (const std::vector< double > &, unsigned int)
 
bool Register_com_surfmesh (const std::string &wname)
 
void Create_com_surfsoln (const std::string &wname, const std::string &fname, std::vector< double > &fvec, unsigned int ncomp, const std::string &unit)
 

Public Attributes

unsigned int _id
 
unsigned int _ngtri
 
unsigned int _ngquad
 
unsigned int _nnodes
 
std::vector< unsigned int > _triconn
 
std::vector< unsigned int > _quadconn
 
std::vector< double > surface_coordinates
 
unsigned int surface_ngnodes
 
std::vector< unsigned int > surface_tri
 
std::vector< unsigned int > surface_quad
 
GEM_UserData _data
 
GEM_UserData _solver_data
 
bool _debug
 
std::ostream * _out
 
int pane_id
 

Detailed Description

Definition at line 125 of file GEM.H.

Constructor & Destructor Documentation

GEM_DomainBoundary ( const GEM_DomainBoundary db)
inline

Definition at line 152 of file GEM.H.

References _data, _debug, _id, _ngquad, _ngtri, _nnodes, _out, _quadconn, and _triconn.

153  {
154  _id = db._id;
155  _out = db._out;
156  _ngtri = db._ngtri;
157  _ngquad = db._ngquad;
158  _triconn = db._triconn;
159  _quadconn = db._quadconn;
160  _debug = db._debug;
161  _data = db._data;
162  _nnodes = db._nnodes;
163  };
unsigned int _nnodes
Definition: GEM.H:130
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 _ngquad
Definition: GEM.H:129
GEM_UserData _data
Definition: GEM.H:137
std::ostream * _out
Definition: GEM.H:140
unsigned int _ngtri
Definition: GEM.H:128
GEM_DomainBoundary ( )
inline

Definition at line 164 of file GEM.H.

References _debug, _id, _ngquad, _ngtri, _nnodes, _out, _quadconn, _triconn, and surface_coordinates.

165  {
166  _id = 0;
167  _out = NULL;
168  _ngtri = 0;
169  _ngquad = 0;
170  _triconn.resize(0);
171  _quadconn.resize(0);
172  _nnodes = 0;
173  // _data.resize(0);
174  _debug = false;
175  surface_coordinates.resize(0);
176  };
unsigned int _nnodes
Definition: GEM.H:130
std::vector< double > surface_coordinates
Definition: GEM.H:133
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 _ngquad
Definition: GEM.H:129
std::ostream * _out
Definition: GEM.H:140
unsigned int _ngtri
Definition: GEM.H:128

Member Function Documentation

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

Definition at line 426 of file GEM.C.

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

Referenced by TRAIL_FluRegisterSurfSoln().

430 {
431  string aname(wname+"."+fname);
432  int ahndl = COM_get_attribute_handle(aname);
433  if(!ahndl)
434  COM_new_attribute(aname,'e',COM_DOUBLE,ncomp,unit.c_str());
435  if(fvec.size() > 0)
436  COM_set_array(aname,pane_id,&fvec[0],ncomp);
437 }
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
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
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 debug ( bool  s = true)
inline

Definition at line 193 of file GEM.H.

References _debug, and s.

Referenced by a_d_tensors(), GEM_Partition::MapDomainBoundaries(), rocfracmain::rocfracsoln(), and writetecplotbinary().

194  {
195  _debug = s;
196  return(_debug);
197  };
double s
Definition: blastest.C:80

Here is the caller graph for this function:

unsigned int NNodes ( void  )

Definition at line 1103 of file GEM.C.

Referenced by GEM_Partition::AddDomainBoundary(), TRAIL_FluResizeSurfSoln(), and TRAIL_RemeshInitFluSurfData().

1104 {
1105  if(_nnodes <= 0){
1106  list<unsigned int> snlist;
1107  vector<unsigned int>::iterator ci = _triconn.begin();
1108  while(ci != _triconn.end())
1109  snlist.push_back(*ci++);
1110  ci = _quadconn.begin();
1111  while(ci != _quadconn.end())
1112  snlist.push_back(*ci++);
1113  snlist.sort();
1114  snlist.unique();
1115  _nnodes = snlist.size();
1116  }
1117  return(_nnodes);
1118 }
unsigned int _nnodes
Definition: GEM.H:130
std::vector< unsigned int > _quadconn
Definition: GEM.H:132
std::vector< unsigned int > _triconn
Definition: GEM.H:131

Here is the caller graph for this function:

GEM_DomainBoundary& operator= ( const GEM_DomainBoundary db)
inline

Definition at line 177 of file GEM.H.

References _data, _debug, _id, _ngquad, _ngtri, _nnodes, _out, _quadconn, _triconn, surface_coordinates, surface_quad, and surface_tri.

178  {
179  _id = db._id;
180  _out = db._out;
181  _ngtri = db._ngtri;
182  _ngquad = db._ngquad;
183  _triconn = db._triconn;
184  _quadconn = db._quadconn;
185  _data = db._data;
186  _debug = db._debug;
187  _nnodes = db._nnodes;
191  return(*this);
192  };
unsigned int _nnodes
Definition: GEM.H:130
std::vector< unsigned int > surface_quad
Definition: GEM.H:136
std::vector< double > surface_coordinates
Definition: GEM.H:133
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 _ngquad
Definition: GEM.H:129
std::vector< unsigned int > surface_tri
Definition: GEM.H:135
GEM_UserData _data
Definition: GEM.H:137
std::ostream * _out
Definition: GEM.H:140
unsigned int _ngtri
Definition: GEM.H:128
void PopulateSurfaceArrays ( const std::vector< double > &  ic,
unsigned int  ngnodes 
)

Definition at line 233 of file GEM.C.

Referenced by GEM_Partition::PopulateSurfaceWindow().

235 {
236  if(_debug && _out)
237  *_out <<"GEM_DomainBoundary::PopulateSurfaceArrays(" << _id
238  << "): Enter\n";
239  map<unsigned int,unsigned int> s2v_imap; // idex map surface NC to volume NC
240  list<unsigned int> nodelist;
241  std::vector<unsigned int>::iterator ci = _triconn.begin();
242  unsigned int indy = 0;
243  while(ci != _triconn.end()){
244  if(*ci == 0){
245  if(_out)
246  *_out << "GEM_DomainBoundary::PopulateSurfaceArrays: Error: Found 0 in"
247  << " triangle conn. for boundary_id = " << _id << "\n"
248  << " triangle/node (" << indy/3 << "," << (indy-((indy/3)*3)+1)
249  << ")\n"
250  << " Number of total triangles = " << _triconn.size()/3 << "\n"
251  << " Number of ghost tri = " << _ngtri << "\n";
252  exit(1);
253  }
254  nodelist.push_back(*ci++);
255  indy++;
256  }
257  ci = _quadconn.begin();
258  while(ci != _quadconn.end()){
259  assert(*ci != 0);
260  nodelist.push_back(*ci++);
261  }
262  if(_debug && _out)
263  *_out << "GEM_DomainBoundary::PopulateSurfaceArrays(" << _id << "): "
264  << "nnodes before sort/unique: " << nodelist.size() << "\n";
265  nodelist.sort();
266  nodelist.unique();
267  if(_debug && _out)
268  *_out << "GEM_DomainBoundary::PopulateSurfaceArrays)" << _id << "): "
269  << "nnodes after sort/unique: " << nodelist.size() << "\n";
270 
271  unsigned int nreal_volume_nodes = ic.size()/3 - ngnodes;
272  unsigned int nreal_tris = _triconn.size()/3 - _ngtri;
273  unsigned int nreal_quads = _quadconn.size()/3 - _ngquad;
274  // Run a debugging check on the surface nodes
275  if(_debug){
276  bool fail = false;
277  list<unsigned int>::iterator nli = nodelist.begin();
278  while(nli != nodelist.end()){
279  // Make sure NO ghost nodes live in real elements
280  if(*nli > nreal_volume_nodes){
281  unsigned int nrel = 0;
282  // Check real triangles
283  vector<unsigned int>::iterator ti = _triconn.begin();
284  while(nrel < nreal_tris){
285  int ein = 0;
286  while(ein < 3){
287  if((unsigned int)*nli == (unsigned int)*ti++){
288  if(_out)
289  *_out << "GEM_DomainBoundary::PopulateSurfaceArrays:"
290  << " Found ghost node, volume_id("
291  << *nli
292  << ") in real tri(" << nrel+1
293  << ") of surface " << _id << ". Aborting." << endl;
294  fail = true;
295  }
296  ein++;
297  }
298  nrel++;
299  }
300  // Check real quads
301  nrel = 0;
302  ti = _quadconn.begin();
303  while(nrel < nreal_quads){
304  int ein = 0;
305  while(ein < 4){
306  if(*nli == *ti++){
307  if(_out)
308  *_out << "GEM_DomainBoundary::PopulateSurfaceArrays:"
309  << " Found ghost node, volume_id("
310  << *nli << ") in real quad(" << nrel+1
311  << ") of surface " << _id << ". Aborting." << endl;
312  fail = true;
313  }
314  ein++;
315  }
316  nrel++;
317  }
318  }
319  // It's a real node, warn if it's isolated
320  else {
321  unsigned int nrel = 0;
322  // Check real triangles
323  vector<unsigned int>::iterator ti = _triconn.begin();
324  bool found = false;
325  while(nrel < nreal_tris && !found){
326  int ein = 0;
327  while(ein < 3 && !found){
328  if((unsigned int)*nli == (unsigned int)*ti++)
329  found = true;
330  ein++;
331  }
332  nrel++;
333  }
334  // Check real quads
335  nrel = 0;
336  ti = _quadconn.begin();
337  while(nrel < nreal_quads && !found){
338  int ein = 0;
339  while(ein < 4 && !found){
340  if(*nli == *ti++)
341  found = true;
342  ein++;
343  }
344  nrel++;
345  }
346  if(!found && _out)
347  *_out << "GEM_DomainBoundary::PopulateSurfaceArrays: WARNING: "
348  << " Found isolated real node(" << *nli << ") on surface."
349  << std::endl;
350  }
351  nli++;
352  }
353  if(fail){
354  if(_out)
355  *_out << "GEM_DomainBoundary::PopulateSurfaceArrays: "
356  << "Aborting due to previous errors." << std::endl;
357  exit(1);
358  }
359  }
360  surface_coordinates.resize(3*nodelist.size());
361  unsigned int nghosts = 0;
362  unsigned int nvol_real = ic.size()/3 - ngnodes;
363  unsigned int real_node = 0;
364  unsigned int ghost_node = 0;
365  list<unsigned int>::iterator nli = nodelist.begin();
366  while(nli != nodelist.end())
367  if(*nli++ > nvol_real)
368  nghosts++;
369  nli = nodelist.begin();
370  unsigned int nreal_nodes = nodelist.size() - nghosts;
371  if(_debug && _out){
372  *_out << "GEM_DomainBoundary::PopulateSurfaceArrays(" << _id
373  << "): Nodes("
374  << nreal_nodes << "," << nghosts << ")\n";
375  }
376  while(nli != nodelist.end()){
377  unsigned int node = *nli++; // the volume node index
378  if(node > nvol_real){
379  surface_coordinates[(nreal_nodes+ghost_node)*3] = ic[(node -1)*3];
380  surface_coordinates[(nreal_nodes+ghost_node)*3+1] = ic[(node -1)*3+1];
381  surface_coordinates[(nreal_nodes+ghost_node)*3+2] = ic[(node -1)*3+2];
382  ghost_node++;
383  s2v_imap.insert(make_pair(node,nreal_nodes+ghost_node));
384  }
385  else{
386  surface_coordinates[real_node*3] = ic[(node-1)*3];
387  surface_coordinates[real_node*3+1] = ic[(node-1)*3+1];
388  surface_coordinates[real_node*3+2] = ic[(node-1)*3+2];
389  real_node++;
390  s2v_imap.insert(make_pair(node,real_node));
391  }
392  }
393  surface_ngnodes = ghost_node;
394  ci = _triconn.begin();
395  surface_tri.resize(_triconn.size());
396  surface_quad.resize(_quadconn.size());
397  unsigned int ind = 0;
398  while(ci != _triconn.end())
399  surface_tri[ind++] = s2v_imap[*ci++];
400  ind = 0;
401  ci = _quadconn.begin();
402  while(ci != _quadconn.end())
403  surface_quad[ind++] = s2v_imap[*ci++];
404  if(_debug && _out)
405  *_out << "GEM_DomainBoundary::PopulateSurfaceArrays(" << _id
406  << "): Exit\n";
407 }
std::vector< unsigned int > surface_quad
Definition: GEM.H:136
std::vector< double > surface_coordinates
Definition: GEM.H:133
std::vector< unsigned int > _quadconn
Definition: GEM.H:132
Definition: adj.h:150
unsigned int _id
Definition: GEM.H:127
std::vector< unsigned int > _triconn
Definition: GEM.H:131
unsigned int _ngquad
Definition: GEM.H:129
unsigned int surface_ngnodes
Definition: GEM.H:134
std::vector< unsigned int > surface_tri
Definition: GEM.H:135
std::ostream * _out
Definition: GEM.H:140
unsigned int _ngtri
Definition: GEM.H:128

Here is the caller graph for this function:

bool Register_com_surfmesh ( const std::string &  wname)

Definition at line 545 of file GEM.C.

References COM_set_array(), and COM_set_size().

Referenced by GEM_Partition::PopulateSurfaceWindow().

546 {
547  // Set the surface mesh entity sizes and register the arrays
548  COM_set_size((wname+".nc"),pane_id,surface_coordinates.size()/3,
550  COM_set_array((wname+".nc"),pane_id,&surface_coordinates[0],3);
551  unsigned int nreal = _triconn.size()/3 - _ngtri;
552  if(nreal > 0){
553  COM_set_size((wname+".:t3:real"),pane_id,nreal);
554  COM_set_array((wname+".:t3:real"),pane_id,&(surface_tri[0]),3);
555  }
556  nreal = _quadconn.size()/4 - _ngquad;
557  if(nreal > 0){
558  COM_set_size((wname+".:q4:real"),pane_id,nreal);
559  COM_set_array((wname+".:q4:real"),pane_id,&(surface_quad[0]),4);
560  }
561  if(_ngtri > 0){
562  nreal = _triconn.size()/3-_ngtri;
563  COM_set_size((wname+".:t3:virtual"),pane_id,_ngtri,_ngtri);
564  COM_set_array((wname+".:t3:virtual"),pane_id,&(surface_tri[nreal*3]),3);
565  }
566  if(_ngquad > 0){
567  nreal = _quadconn.size()/4-_ngquad;
568  COM_set_size((wname+".:q4:virtual"),pane_id,_ngquad,_ngquad);
569  COM_set_array((wname+".:q4:virtual"),pane_id,&(surface_quad[nreal*4]),4);
570  }
571  return(true);
572 }
std::vector< unsigned int > surface_quad
Definition: GEM.H:136
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< double > surface_coordinates
Definition: GEM.H:133
std::vector< unsigned int > _quadconn
Definition: GEM.H:132
std::vector< unsigned int > _triconn
Definition: GEM.H:131
unsigned int _ngquad
Definition: GEM.H:129
unsigned int surface_ngnodes
Definition: GEM.H:134
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::vector< unsigned int > surface_tri
Definition: GEM.H:135
unsigned int _ngtri
Definition: GEM.H:128

Here is the call graph for this function:

Here is the caller graph for this function:

void report ( )

Definition at line 181 of file GEM.C.

Referenced by GEM_Partition::report_domain_boundaries().

182 {
183  if(_out){
184  *_out << "Domain Boundary ID: " << _id << endl
185  << " Triangles: (" << _triconn.size()/3 << "," << _ngtri << ")"
186  << endl
187  << " Quads: (" << _quadconn.size()/4 << "," << _ngquad
188  << ")" << endl;
189  }
190 }
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 _ngquad
Definition: GEM.H:129
std::ostream * _out
Definition: GEM.H:140
unsigned int _ngtri
Definition: GEM.H:128

Here is the caller graph for this function:

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

Definition at line 1121 of file GEM.C.

1125 {
1126  _solver_data._string_data.push_back(wname);
1127  _solver_data._field_data.resize(2);
1128  unsigned int ncells = _triconn.size()/3 + _quadconn.size()/4;
1129  unsigned int nnodes = NNodes();
1130  if(_debug && _out)
1131  *_out << "GEM_DomainBoundary(" << _id << ")::SetSolverDataBlock: "
1132  << "Receiving data for " << nval_cells << " doubles on " << ncells
1133  << " cells and " << nval_nodes << " doubles on " << nnodes
1134  << " nodes." << std::endl;
1135  _solver_data._field_data[0].resize(nval_cells*ncells);
1136  _solver_data._field_data[1].resize(nval_nodes*nnodes);
1137  _solver_data._stride_field.resize(2);
1138  _solver_data._stride_field[0] = nval_cells;
1139  _solver_data._stride_field[1] = nval_nodes;
1140  memcpy(&_solver_data._field_data[0][0],cell_data,
1141  sizeof(double)*nval_cells*ncells);
1142  memcpy(&_solver_data._field_data[1][0],node_data,
1143  sizeof(double)*nval_nodes*nnodes);
1144  return(true);
1145 }
std::vector< std::string > _string_data
Definition: GEM.H:105
unsigned int NNodes(void)
Definition: GEM.C:1103
std::vector< unsigned int > _quadconn
Definition: GEM.H:132
GEM_UserData _solver_data
Definition: GEM.H:138
std::vector< std::vector< double > > _field_data
Definition: GEM.H:95
unsigned int _id
Definition: GEM.H:127
std::vector< unsigned int > _triconn
Definition: GEM.H:131
std::vector< int > _stride_field
Definition: GEM.H:103
std::ostream * _out
Definition: GEM.H:140

Member Data Documentation

unsigned int _nnodes

Definition at line 130 of file GEM.H.

Referenced by GEM_Partition::AddDomainBoundary(), GEM_DomainBoundary(), and operator=().

GEM_UserData _solver_data

Definition at line 138 of file GEM.H.

Referenced by TRAIL_RemeshInitFluSurfData().

std::vector<double> surface_coordinates

Definition at line 133 of file GEM.H.

Referenced by GEM_DomainBoundary(), and operator=().

unsigned int surface_ngnodes

Definition at line 134 of file GEM.H.

std::vector<unsigned int> surface_quad

Definition at line 136 of file GEM.H.

Referenced by operator=().

std::vector<unsigned int> surface_tri

Definition at line 135 of file GEM.H.

Referenced by operator=().


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