Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TRAIL_Flu.H File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool TRAIL_FluInitSolver (GEM_Partition &gp, const std::string &prefix="./")
 
bool TRAIL_FluReadControlFile (GEM_Partition &gp, const std::string &prefix="./")
 
bool TRAIL_FluWriteCOM (GEM_Partition &gp, const std::string &path)
 
bool TRAIL_FluReadCOM (GEM_Partition &gp)
 
bool TRAIL_FluWriteMAP (GEM_Partition &gp, unsigned int nproc, unsigned int nregions, const std::string &path)
 
bool TRAIL_FluWriteDIM (GEM_Partition &gp, double t=0.0, bool unsteady=true, const std::string &path="./")
 
bool TRAIL_FluReadDIM (GEM_Partition &gp, double t=0.0, bool unsteady=true)
 
bool TRAIL_FluPopRemBordIndFILE (GEM_Partition &gp, double t=0.0, bool unsteady=true, const std::string &path="./")
 
bool TRAIL_FluWriteCMP (GEM_Partition &gp, const std::string &path)
 
void TRAIL_FluResizeVolSoln (GEM_Partition &gp)
 
bool TRAIL_FluInitVolSoln (GEM_Partition &gp)
 
void TRAIL_FluResizeSurfSoln (GEM_DomainBoundary &db)
 
bool TRAIL_FluInitSurfSoln (GEM_DomainBoundary &db, const std::string &, bool all=true)
 
bool TRAIL_FluInitSurfSoln (GEM_Partition &gp)
 
int TRAIL_FluNumPatches (GEM_Partition &gp)
 
bool TRAIL_FluRegisterVolSoln (GEM_Partition &gp, bool all=true)
 
bool TRAIL_FluRegisterSurfSoln (GEM_DomainBoundary &db, const std::string &wname, bool all=true)
 
bool TRAIL_FluRegisterSurfSoln (GEM_Partition &gp, bool all=true)
 
bool TRAIL_FluRegisterSurfMesh (GEM_Partition &gp)
 
bool TRAIL_FluBuildPatchMapping (std::map< unsigned int, unsigned int > &pmap, const std::string &prefix)
 
bool TRAIL_FluWriteNative (GEM_Partition &gp, const std::string &path)
 
bool TRAIL_FluPopulatePatches (GEM_Partition &gp)
 
bool TRAIL_FluReadGridASCII (GEM_Partition &gp, double t=0.0, bool unsteady=true)
 
void TRAIL_FluCopyCaseFiles (GEM_Partition &gp, const std::string &path)
 

Function Documentation

bool TRAIL_FluBuildPatchMapping ( std::map< unsigned int, unsigned int > &  pmap,
const std::string &  prefix 
)

Definition at line 1331 of file RocfluFunctions.C.

Referenced by TRAIL_FluPopulatePatches().

1333 {
1334  // Build the patch mapping from the hand produced patch mapping file
1335  ostringstream Ostr;
1336  string pre(prefix);
1337  // if(pre.empty()){
1338  // if(_casename.empty())
1339  // pre = "./";
1340  // else
1341  // pre = _casepath + "/" + _casename;
1342  //}
1343  Ostr << pre << ".cgi";
1344  ifstream bcfile;
1345  bcfile.open(Ostr.str().c_str());
1346  if(!bcfile)
1347  return(false);
1348  // map< unsigned int,unsigned int > pmap;
1349  unsigned int nggpmap_lines;
1350  unsigned int npatches_total;
1351  // _solver_data._int_data[1][0] is _npatches_total
1352  bcfile >> npatches_total >> nggpmap_lines;
1353  unsigned int patch_line = 0;
1354  while(patch_line < nggpmap_lines){
1355  unsigned int low, high, flupatch;
1356  bcfile >> low >> high >> flupatch;
1357  unsigned int p = low;
1358  while(p <= high)
1359  pmap[p++] = flupatch;
1360  patch_line++;
1361  }
1362  // if(_debug && _out){
1363  // *_out << "BuildFluPatchMapping: Patch Mapping:\n";
1364  // map<unsigned int,unsigned int>::iterator mi = pmap.begin();
1365  // while(mi != pmap.end()){
1366  // *_out << "BuildFluPatchMapping: (" << mi->first << ","
1367  // << mi->second << ")\n";
1368  // mi++;
1369  // }
1370  // }
1371  bcfile.close();
1372  return(true);
1373 }

Here is the caller graph for this function:

void TRAIL_FluCopyCaseFiles ( GEM_Partition gp,
const std::string &  path 
)

Definition at line 1543 of file RocfluFunctions.C.

References GEM_Partition::_solver_data, and GEM_UserData::_string_data.

Referenced by TRAIL_RemeshWrite().

1544 {
1545  std::string casename(gp._solver_data._string_data[0]);
1546  std::string casepath(gp._solver_data._string_data[1]);
1547  std::ifstream Inf;
1548  std::ofstream Ouf;
1549  std::string filename;
1550  filename.assign(casename+".bc");
1551  Inf.open((casepath+"/"+filename).c_str());
1552  Ouf.open((path+"/"+filename).c_str());
1553  Ouf << Inf.rdbuf();
1554  Ouf.close();
1555  Inf.close();
1556  Ouf.clear();
1557  Inf.clear();
1558  filename.assign(casename+".cgi");
1559  Inf.open((casepath+"/"+filename).c_str());
1560  Ouf.open((path+"/"+filename).c_str());
1561  Ouf << Inf.rdbuf();
1562  Ouf.close();
1563  Inf.close();
1564  Ouf.clear();
1565  Inf.clear();
1566  filename.assign(casename+".inp");
1567  Inf.open((casepath+"/"+filename).c_str());
1568  Ouf.open((path+"/"+filename).c_str());
1569  Ouf << Inf.rdbuf();
1570  Ouf.close();
1571  Inf.close();
1572  Ouf.clear();
1573  Inf.clear();
1574  filename.assign(casename+".map");
1575  Inf.open((casepath+"/"+filename).c_str());
1576  Ouf.open((path+"/"+filename).c_str());
1577  Ouf << Inf.rdbuf();
1578  Ouf.close();
1579  Inf.close();
1580 }
std::vector< std::string > _string_data
Definition: GEM.H:105
GEM_UserData _solver_data
Definition: GEM.H:307

Here is the caller graph for this function:

bool TRAIL_FluInitSolver ( GEM_Partition gp,
const std::string &  prefix = "./" 
)

Definition at line 59 of file RocfluFunctions.C.

References GEM_UserData::_int_data, GEM_Partition::_solver_data, GEM_UserData::_stride_int, TRAIL_FluNumPatches(), and TRAIL_FluReadControlFile().

Referenced by main(), and TRAIL_RemeshWrite().

60 {
61  if(!TRAIL_FluReadControlFile(gp,prefix))
62  return(false);
63  gp._solver_data._int_data.resize(2);
64  gp._solver_data._stride_int.resize(2);
65  gp._solver_data._int_data[1].resize(1);
66  gp._solver_data._stride_int[1] = 1;
68  if(gp._solver_data._int_data[1][0] == 0)
69  return(false);
70  return true;
71 }
bool TRAIL_FluReadControlFile(GEM_Partition &gp, const std::string &prefix="./")
std::vector< std::vector< int > > _int_data
Definition: GEM.H:100
std::vector< int > _stride_int
Definition: GEM.H:104
GEM_UserData _solver_data
Definition: GEM.H:307
int TRAIL_FluNumPatches(GEM_Partition &gp)

Here is the call graph for this function:

Here is the caller graph for this function:

bool TRAIL_FluInitSurfSoln ( GEM_DomainBoundary db,
const std::string &  ,
bool  all = true 
)

Definition at line 1002 of file RocfluFunctions.C.

References GEM_DomainBoundary::_data, GEM_DomainBoundary::_debug, GEM_DomainBoundary::_id, GEM_UserData::_int_data, GEM_DomainBoundary::_out, GEM_DomainBoundary::_quadconn, GEM_UserData::_stride_int, GEM_DomainBoundary::_triconn, and TRAIL_FluResizeSurfSoln().

Referenced by main(), TRAIL_FluInitSurfSoln(), and TRAIL_RemeshInitFluSurfData().

1003 {
1004  string pre(prefix);
1005  if(pre.empty())
1006  return(false);
1007  unsigned int ntri = db._triconn.size()/3;
1008  unsigned int nquad = db._quadconn.size()/4;
1009  unsigned int nfaces = ntri + nquad;
1010  // unsigned int nvert = db.NNodes();
1011  // if(all){
1012  // FIXME FIXME
1013  //#ifdef _ROCSTAR_X_
1015  //#else
1016  // Rocflu only needs only gsp for field data
1017  // nfaces = (ntri+nquad)- (_ngtri + _ngquad);
1018  // TRAIL_FluResizeSurfSoln(nfaces,nvert,db);
1019  // for(int i = 1;i < 22;i++){
1020  // db._data._field_data[i].resize(0);
1021  // db._data._stride_field[i] = 0;
1022  // }
1023  //#endif
1024  // }
1025  //#ifdef _ROCSTAR_X_
1026  int constraint_map[] = { 2 , 120, 121, 122, -122, -121, -120, 0};
1027  // Populate the Rocstar data living on the surface
1028  string fname(pre+".bc");
1029  ifstream Inf;
1030  Inf.open(fname.c_str());
1031  if(!Inf){
1032  if(db._out)
1033  *db._out << "TRAIL_FluInitSurfSoln: Error: could not locate bc file, "
1034  << fname << "." << std::endl;
1035  return false;
1036  }
1037  string line;
1038  bool found_patch = false;
1039  while(getline(Inf,line) && !found_patch){
1040  if(line[0] != '#'){
1041  string::size_type patchx = line.find("PATCH");
1042  if( patchx != string::npos){
1043  string tstr;
1044  unsigned int ubound,lbound;
1045  istringstream Istr(line);
1046  Istr >> tstr >> lbound >> ubound;
1047  if(db._id >= lbound && db._id <= ubound)
1048  found_patch = true;
1049  }
1050  }
1051  }
1052  if(!found_patch){
1053  if(db._out)
1054  *db._out << "TRAIL_FluInitSurfSoln: Error: "
1055  << "Did not find patch " << db._id << " in bc file." << endl;
1056  return(false);
1057  }
1058  // Now we want to search forward for the relevant data until we encounter #
1059  bool end_section = false;
1060  db._data._int_data[1][0] = 2; //_bcflag = 2;
1061  db._data._int_data[2][0] = 2; // _constr_type = 2;
1062  db._data._stride_int[1] = 1;
1063  db._data._stride_int[2] = 1;
1064  while(getline(Inf,line) && !end_section){
1065  if(line[0] == '#') end_section = true;
1066  else{
1067  string::size_type movx = line.find("MOVEDIR");
1068  string::size_type coupx = line.find("COUPLED");
1069  string::size_type burn = line.find("BFLAG");
1070  if(movx != string::npos){
1071  string tstr;
1072  int mvdir;
1073  istringstream Istr(line);
1074  Istr >> tstr >> mvdir;
1075  db._data._int_data[2][0] = constraint_map[mvdir];
1076  }
1077  if(coupx != string::npos){
1078  string tstr;
1079  istringstream Istr(line);
1080  Istr >> tstr >> db._data._int_data[1][0];
1081  }
1082  if(burn != string::npos){
1083  string tstr;
1084  unsigned int burnf = 0;
1085  istringstream Istr(line);
1086  Istr >> tstr >> burnf;
1087  db._data._int_data[0].resize(nfaces,burnf);
1088  db._data._stride_int[0] = 1;
1089  }
1090  }
1091  }
1092  //#endif
1093  Inf.close();
1094  if(db._debug && db._out)
1095  *db._out << "TRAIL_FluInitSurfSoln: Exit" << endl;
1096  return true;
1097 }
void TRAIL_FluResizeSurfSoln(GEM_DomainBoundary &db)
std::vector< std::vector< int > > _int_data
Definition: GEM.H:100
std::vector< unsigned int > _quadconn
Definition: GEM.H:132
std::vector< int > _stride_int
Definition: GEM.H:104
unsigned int _id
Definition: GEM.H:127
std::vector< unsigned int > _triconn
Definition: GEM.H:131
GEM_UserData _data
Definition: GEM.H:137
std::ostream * _out
Definition: GEM.H:140

Here is the call graph for this function:

Here is the caller graph for this function:

bool TRAIL_FluInitSurfSoln ( GEM_Partition gp)

Definition at line 1145 of file RocfluFunctions.C.

References GEM_Partition::_db, GEM_Partition::_out, GEM_Partition::_solver_data, GEM_UserData::_string_data, n, and TRAIL_FluInitSurfSoln().

1146 {
1147  if(gp._solver_data._string_data.size() < 3 ||
1148  gp._solver_data._string_data[1].empty()){
1149  if(gp._out)
1150  *gp._out << "TRAIL_FluInitSurfSoln::Error: Solver data contains no"
1151  << " path." << std::endl;
1152  return(false);
1153  }
1154  unsigned int ndb = gp._db.size();
1155  unsigned int n = 0;
1156  std::string pre(gp._solver_data._string_data[1]+"/"+
1157  gp._solver_data._string_data[0]);
1158  while(n < ndb){
1159  if(!TRAIL_FluInitSurfSoln(gp._db[n++],pre,true))
1160  return(false);
1161  }
1162  return(true);
1163 }
std::vector< std::string > _string_data
Definition: GEM.H:105
bool TRAIL_FluInitSurfSoln(GEM_DomainBoundary &db, const std::string &, bool all=true)
std::vector< GEM_DomainBoundary > _db
Definition: GEM.H:305
std::ostream * _out
Definition: GEM.H:308
const NT & n
GEM_UserData _solver_data
Definition: GEM.H:307

Here is the call graph for this function:

bool TRAIL_FluInitVolSoln ( GEM_Partition gp)

Definition at line 828 of file RocfluFunctions.C.

References GEM_Partition::_data, GEM_Partition::_debug, GEM_UserData::_field_data, GEM_Partition::_hexconn, GEM_UserData::_int_data, GEM_Partition::_out, GEM_Partition::_prisconn, GEM_Partition::_pyrconn, GEM_Partition::_solver_data, GEM_UserData::_stride_field, GEM_UserData::_string_data, GEM_Partition::_tetconn, sqrt(), and TRAIL_FluResizeVolSoln().

Referenced by main(), and TRAIL_RemeshInitFluVolData().

829 {
830  if(gp._solver_data._string_data.size() < 3 ||
831  gp._solver_data._string_data[1].empty()){
832  if(gp._out)
833  *gp._out << " TRAIL_FluInitVolSoln::Error: Solver data contains no path."
834  << std::endl;
835 
836  return(false);
837  }
838  string pre(gp._solver_data._string_data[1]+"/"+
839  gp._solver_data._string_data[0]);
840  string fname(pre+".inp");
841  ifstream Inf;
842  Inf.open(fname.c_str());
843  if(!Inf){
844  if(gp._out)
845  *gp._out << " TRAIL_FluInitVolSoln::Error: Could not open " << fname
846  << "." << std::endl;
847 
848  return false;
849  }
850  unsigned int ntet = gp._tetconn.size()/4;
851  unsigned int npyr = gp._pyrconn.size()/5;
852  unsigned int nhex = gp._hexconn.size()/8;
853  unsigned int npris = gp._prisconn.size()/6;
854  unsigned int nelem = ntet + npyr + npris + nhex;
855  // unsigned int nvert = gp._nc.size()/3;
857  string line;
858  double cp = -1.0;
859  double gamma = -1.0;
860  double velx = 0.0;
861  double vely = 0.0;
862  double velz = 0.0;
863  double press = -1.0;
864  double rho = -1.0;
865  if(gp._debug && gp._out)
866  *gp._out << "TRAIL_FluInitVolSoln: Initializing volume data." << std::endl;
867  while(getline(Inf,line)){
868  if(line[0] != '#'){
869  string::size_type xtime = line.find("STARTTIME");
870  string::size_type ftype = line.find("FLOWTYPE");
871  string::size_type xgamma = line.find("GAMMA");
872  string::size_type xpress = line.find("PRESS");
873  string::size_type x_dens = line.find("DENS");
874  string::size_type x_velx = line.find("VELX");
875  string::size_type x_vely = line.find("VELY");
876  string::size_type x_velz = line.find("VELZ");
877  string::size_type x_cp = line.find("CP");
878  string tstr;
879  istringstream Istr(line);
880  if(xtime != string::npos)
881  Istr >> tstr >> gp._data._field_data[0][0]; // current time
882  if(ftype != string::npos)
883  Istr >> tstr >> gp._data._int_data[0][0]; // flowtype (steady/unsteady)
884  if(xgamma != string::npos)
885  Istr >> tstr >> gamma;
886  if(xpress != string::npos)
887  Istr >> tstr >> press;
888  if(x_dens != string::npos)
889  Istr >> tstr >> rho;
890  if(x_velx != string::npos)
891  Istr >> tstr >> velx;
892  if(x_vely != string::npos)
893  Istr >> tstr >> vely;
894  if(x_velz != string::npos)
895  Istr >> tstr >> velz;
896  if(x_cp != string::npos)
897  Istr >> tstr >> cp;
898  }
899  }
900  if(gamma < 0 || press < 0 || rho < 0 || cp < 0)
901  return(false);
902  gp._data._field_data[2].resize(nelem,rho); // rhof
903  gp._data._stride_field[2] = 1;
904  double E = press/(rho*(gamma - 1.0)) +
905  (velx*velx + vely*vely + velz*velz)/2.0;
906  gp._data._field_data[3].resize(3*nelem,0.0); // rhovf
907  gp._data._stride_field[3] = 3;
908  if(velx != 0.0 || vely != 0.0 || velz != 0.0){
909  unsigned int index = 0;
910  for(unsigned int el = 0;el < nelem;el++){
911  gp._data._field_data[3][index++] = rho*velx;
912  gp._data._field_data[3][index++] = rho*vely;
913  gp._data._field_data[3][index++] = rho*velz;
914  }
915  }
916  double R = (cp*(gamma-1.0))/gamma;
917  double Ti = press/(rho*R);
918  double C = sqrt(gamma*press/rho);
919  gp._data._field_data[4].resize(nelem,rho*E); // rhoEf
920  gp._data._stride_field[4] = 1;
921  gp._data._field_data[5].resize(nelem,press); // pf
922  gp._data._stride_field[5] = 1;
923  gp._data._field_data[6].resize(nelem,Ti); // Tf
924  gp._data._stride_field[6] = 1;
925  gp._data._field_data[7].resize(nelem,C); // af
926  gp._data._stride_field[7] = 1;
927  // _data._field_data[8].resize(gp._nc.size(),0.0); // disp
928  // _data._stride_field[8] = 3;
929  // gp._data._field_data[9].resize(gp._nvface,0.0); // gridspeeds (gsp)
930  // gp._data._stride_field[9] = 1;
931  if(gp._debug && gp._out)
932  *gp._out << "TRAIL_FluInitVolSoln: Volume data initialized." << std::endl;
933  return(true);
934 }
GEM_UserData _data
Definition: GEM.H:306
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
std::vector< std::vector< int > > _int_data
Definition: GEM.H:100
std::vector< std::string > _string_data
Definition: GEM.H:105
double sqrt(double d)
Definition: double.h:73
std::vector< std::vector< double > > _field_data
Definition: GEM.H:95
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
void TRAIL_FluResizeVolSoln(GEM_Partition &gp)
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< unsigned int > _prisconn
Definition: GEM.H:299

Here is the call graph for this function:

Here is the caller graph for this function:

int TRAIL_FluNumPatches ( GEM_Partition gp)

Definition at line 1100 of file RocfluFunctions.C.

References GEM_Partition::_out, GEM_Partition::_solver_data, and GEM_UserData::_string_data.

Referenced by TRAIL_FluInitSolver().

1101 {
1102  if(gp._solver_data._string_data.size() < 3 ||
1103  gp._solver_data._string_data[0].empty() ||
1104  gp._solver_data._string_data[1].empty()){
1105  if(gp._out)
1106  *gp._out << "TRAIL_FluNumPatches:Error: solver data has no casename"
1107  << " or path." << std::endl;
1108  return 0;
1109  }
1110  string pre(gp._solver_data._string_data[1]+ "/" +
1111  gp._solver_data._string_data[0]);
1112  string filename(pre+".bc");
1113  ifstream Inf;
1114  Inf.open(filename.c_str());
1115  string line;
1116  int npatches = 0;
1117  if(!Inf) return 0;
1118  while(!Inf.eof()){
1119  bool found = false;
1120  while(!found){
1121  getline(Inf,line);
1122  if(line[0] == '#')
1123  found = true;
1124  }
1125  found = false;
1126  while(getline(Inf,line) && !found){
1127  if(line[0] != '#'){
1128  string::size_type patchx = line.find("PATCH");
1129  if( patchx != string::npos){
1130  string tstr;
1131  unsigned int ubound,lbound;
1132  istringstream Istr(line);
1133  Istr >> tstr >> lbound >> ubound;
1134  npatches += ((ubound - lbound) + 1);
1135  found = true;
1136  }
1137  }
1138  }
1139  }
1140  Inf.close();
1141  return npatches;
1142 }
std::vector< std::string > _string_data
Definition: GEM.H:105
std::ostream * _out
Definition: GEM.H:308
GEM_UserData _solver_data
Definition: GEM.H:307

Here is the caller graph for this function:

bool TRAIL_FluPopRemBordIndFILE ( GEM_Partition gp,
double  t = 0.0,
bool  unsteady = true,
const std::string &  path = "./" 
)

Definition at line 588 of file RocfluFunctions.C.

References GEM_Partition::_debug, GEM_Partition::_id, GEM_UserData::_int_data, GEM_Partition::_out, GEM_Partition::_pb, GEM_Partition::_solver_data, GEM_UserData::_string_data, and SkipLines().

Referenced by TRAIL_RemeshWrite().

590 {
591  if(gp._solver_data._string_data.size() < 3){
592  if(gp._out)
593  *gp._out << "TRAIL_FluPopRemBordIndFILE:Error: No casename or path found."
594  << std::endl;
595  return(false);
596  }
597  std::string pre("./" + path + "/" + gp._solver_data._string_data[0]);
598  unsigned int pbindex = 0;
599  std::vector<GEM_PartitionBoundary>::iterator fbi = gp._pb.begin();
600  while(fbi != gp._pb.end()){
601  std::ifstream Inf;
602  std::ostringstream Ostr;
603  Ostr << pre << ".dim_";
604  Ostr << setw(5) << setfill('0');
605  Ostr << fbi->_rpart;
606  std::string filebase(Ostr.str());
607  if(unsteady){
608  Ostr.clear();
609  Ostr.str("");
610  Ostr << "_" << scientific << setprecision(5) << t;
611  std::string timestring(Ostr.str());
612  timestring.replace(8,1,"E");
613  filebase+=timestring;
614  }
615  Inf.open(filebase.c_str());
616  if(!Inf){
617  if(gp._debug && gp._out)
618  *gp._out
619  << "TRAIL_FluPopRemBordIndFILE: Unable to open "
620  << filebase << " for reading.\n";
621  return(false);
622  }
623  string line;
624  unsigned int fakeout = 0;
625  unsigned int nreal_cells = 0;
626  unsigned int nnodes = 0;
627  unsigned int nhex = 0;
628  unsigned int ntet = 0;
629  unsigned int npris = 0;
630  unsigned int npyr = 0;
631  unsigned int ncells = 0;
632  unsigned int npatches = 0;
633  unsigned int nreal_tets = 0;
634  unsigned int nreal_hex = 0;
635  unsigned int nreal_pris = 0;
636  unsigned int nreal_pyr = 0;
637  unsigned int nreal_nodes = 0;
638  unsigned int npatches_total = 0;
639  unsigned int ngnodes = 0;
640  unsigned int ngtet = 0;
641  unsigned int nghex = 0;
642  unsigned int ngpris = 0;
643  unsigned int ngpyr = 0;
644  SkipLines(Inf,2);
645  Inf >> nreal_nodes >> nnodes;
646  SkipLines(Inf,2);
647  Inf >> nreal_cells >> ncells;
648  SkipLines(Inf,2);
649  Inf >> nreal_tets >> ntet;
650  SkipLines(Inf,2);
651  Inf >> nreal_hex >> nhex;
652  SkipLines(Inf,2);
653  Inf >> nreal_pris >> npris;
654  SkipLines(Inf,2);
655  Inf >> nreal_pyr >> npyr;
656  SkipLines(Inf,2);
657  Inf >> npatches >> npatches_total;
658  ngnodes = nnodes - nreal_nodes;
659  ngtet = ntet - nreal_tets;
660  nghex = nhex - nreal_hex;
661  ngpyr = npyr - nreal_pyr;
662  ngpris = npris - nreal_pris;
663  if(gp._debug && gp._out)
664  *gp._out << "GEM_Partition(" << gp._id
665  << ")::PopRemBordIndFILE::Elems: ("
666  << ntet+npris+nhex+npyr
667  << "," << ngtet+nghex+ngpyr+ngpris << ")\n"
668  << "GEM_Partition(" << gp._id << ")::PopRemBordIndFILE"
669  << "::Nodes: ("
670  << nnodes << ","
671  << ngnodes << ")\n"
672  << "GEM_Partition(" << gp._id
673  << ")::PopRemBordIndFILE:: Patches: ("
674  << npatches << ","
675  << npatches_total << ")\n";
676  for(unsigned int pind = 0;pind < npatches;pind++){
677  unsigned int nreal_tri = 0;
678  unsigned int nreal_quad = 0;
679  Inf >> fakeout >> nreal_tri >> fakeout >> nreal_quad >> fakeout;
680  }
681  unsigned int nborders = 0;
682  SkipLines(Inf,2);
683  Inf >> nborders;
684  if(gp._debug && gp._out)
685  *gp._out << "GEM_Partition(" << gp._id << ")::PopRemBordIndFILE:: "
686  << "Number of borders: " << nborders
687  << "\n";
688  bool done = false;
689  for(unsigned int bind = 0;(bind < nborders && !done);bind++){
690  unsigned int rpart;
691  Inf >> rpart;
692  if(rpart == gp._id){
693  gp._solver_data._int_data[0][pbindex++] = bind+1;
694  done = true;
695  }
696  else
697  Inf >> fakeout >> fakeout >> fakeout >> fakeout >> fakeout >> fakeout;
698  }
699  if(!done)
700  return(false);
701  Inf.close();
702  // this->WriteFluDIM(prefix,t,unsteady);
703  fbi++;
704  }
705  return(true);
706 }
std::vector< std::vector< int > > _int_data
Definition: GEM.H:100
std::vector< std::string > _string_data
Definition: GEM.H:105
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
std::vector< GEM_PartitionBoundary > _pb
Definition: GEM.H:304
bool _debug
Definition: GEM.H:310
GEM_UserData _solver_data
Definition: GEM.H:307
istream & SkipLines(istream &, unsigned int=1)

Here is the call graph for this function:

Here is the caller graph for this function:

bool TRAIL_FluPopulatePatches ( GEM_Partition gp)

Definition at line 1377 of file RocfluFunctions.C.

References GEM_Partition::_out, GEM_Partition::_solver_data, GEM_UserData::_string_data, GEM_Partition::MapDomainBoundaries(), and TRAIL_FluBuildPatchMapping().

Referenced by main().

1378 {
1379  if(gp._solver_data._string_data.size() < 3 ||
1380  gp._solver_data._string_data[0].empty() ||
1381  gp._solver_data._string_data[1].empty()){
1382  if(gp._out)
1383  *gp._out << "TRAIL_FluPopulatePatches:Error: solver data has no casename"
1384  << " or path." << std::endl;
1385  return(false);
1386  }
1387  string pre(gp._solver_data._string_data[1]+ "/" +
1388  gp._solver_data._string_data[0]);
1389  map<unsigned int,unsigned int> patch_mapping;
1390  TRAIL_FluBuildPatchMapping(patch_mapping,pre);
1391  gp.MapDomainBoundaries(patch_mapping);
1392  return(true);
1393 }
void MapDomainBoundaries(std::map< unsigned int, unsigned int > &bcmap)
Definition: GEM.C:1385
bool TRAIL_FluBuildPatchMapping(std::map< unsigned int, unsigned int > &pmap, const std::string &prefix)
std::vector< std::string > _string_data
Definition: GEM.H:105
std::ostream * _out
Definition: GEM.H:308
GEM_UserData _solver_data
Definition: GEM.H:307

Here is the call graph for this function:

Here is the caller graph for this function:

bool TRAIL_FluReadCOM ( GEM_Partition gp)

Definition at line 223 of file RocfluFunctions.C.

References GEM_Partition::_debug, GEM_Partition::_id, GEM_UserData::_int_data, GEM_Partition::_out, GEM_Partition::_pb, GEM_Partition::_solver_data, GEM_UserData::_string_data, and SkipLines().

224 {
225  if(gp._solver_data._string_data.size() < 3){
226  if(gp._out)
227  *gp._out << "TRAIL_FluReadCOM::Error: No casename or path found."
228  << std::endl;
229  return(false);
230  }
231 
232  string pre(gp._solver_data._string_data[1] + "/" +
233  gp._solver_data._string_data[0]);
234  if(gp._solver_data._int_data.empty()){
235  if(gp._out)
236  *gp._out
237  << "TRAIL_FluReadCOM: Error,called with empty _int_data."
238  << endl;
239 
240  return(false);
241  }
242  ifstream Inf;
243  ostringstream Ostr;
244  Ostr << pre << ".com_";
245  Ostr << setw(5) << setfill('0');
246  Ostr << gp._id;
247  Inf.open(Ostr.str().c_str());
248  if(!Inf){
249  if(gp._out)
250  *gp._out
251  << "TRAIL_FluReadCOM: Error: Cannot open " << Ostr.str() << "."
252  << std::endl;
253  return(false);
254  }
255  string line;
256  SkipLines(Inf,2);
257  unsigned int nborders = 0;
258  Inf >> nborders;
259  if(gp._debug && gp._out)
260  *gp._out << "TRAIL_FluReadCOM(" << gp._id << "): nborders: "
261  << nborders << "\n";
262  assert(nborders == gp._pb.size() && nborders ==
263  gp._solver_data._int_data[0].size());
264  SkipLines(Inf,2);
265  unsigned int pbindex = 0;
266  vector<GEM_PartitionBoundary>::iterator fbi = gp._pb.begin();
267  while(fbi != gp._pb.end()){
268  unsigned int rpart;
269  int rbid;
270  Inf >> rpart >> rbid;
271  assert(fbi->_rpart == rpart &&
272  gp._solver_data._int_data[0][pbindex++] == rbid);
273  fbi++;
274  }
275  SkipLines(Inf,2);
276  fbi = gp._pb.begin();
277  while(fbi != gp._pb.end()){
278  unsigned int rcells,scells;
279  Inf >> scells >> rcells;
280  assert(scells == fbi->_sendcells.size() &&
281  rcells == fbi->_recvcells.size());
282  int cell = 0;
283  int ncells = fbi->_sendcells.size();
284  while(cell < ncells)
285  Inf >> fbi->_sendcells[cell++];
286  cell = 0;
287  ncells = fbi->_recvcells.size();
288  while(cell < ncells)
289  Inf >> fbi->_recvcells[cell++];
290  fbi++;
291  }
292  SkipLines(Inf,2);
293  fbi = gp._pb.begin();
294  while(fbi != gp._pb.end()){
295  unsigned int nshare,nsend,nrecv;
296  Inf >> nsend >> nrecv >> nshare;
297  assert(nsend == fbi->_sendnodes.size() &&
298  nrecv == fbi->_recvnodes.size() &&
299  nshare == fbi->_sharenodes.size());
300  unsigned int node = 0;
301  unsigned int nnodes = fbi->_sendnodes.size();
302  while(node < nnodes)
303  Inf >> fbi->_sendnodes[node++];
304  node = 0;
305  nnodes = fbi->_recvnodes.size();
306  while(node < nnodes)
307  Inf >> fbi->_recvnodes[node++];
308  nnodes = fbi->_sharenodes.size();
309  node = 0;
310  while(node < nnodes)
311  Inf >> fbi->_sharenodes[node++];
312  fbi++;
313  }
314  Inf.close();
315  return(true);
316 }
std::vector< std::vector< int > > _int_data
Definition: GEM.H:100
std::vector< std::string > _string_data
Definition: GEM.H:105
Definition: adj.h:150
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
std::vector< GEM_PartitionBoundary > _pb
Definition: GEM.H:304
bool _debug
Definition: GEM.H:310
GEM_UserData _solver_data
Definition: GEM.H:307
istream & SkipLines(istream &, unsigned int=1)

Here is the call graph for this function:

bool TRAIL_FluReadControlFile ( GEM_Partition gp,
const std::string &  prefix = "./" 
)

Definition at line 74 of file RocfluFunctions.C.

References GEM_Partition::_solver_data, and GEM_UserData::_string_data.

Referenced by TRAIL_FluInitSolver().

75 {
76  ifstream Inf;
77  string fname;
78  if(!prefix.empty())
79  fname = prefix + "/RocfluControl.txt";
80  Inf.open(fname.c_str());
81  if(!Inf)
82  return false;
83  gp._solver_data._string_data.resize(3);
84  gp._solver_data._string_data[2] = prefix; // solver name
85  // casename and casepath
86  Inf >> gp._solver_data._string_data[0] >> gp._solver_data._string_data[1];
87  Inf.close();
88  return(true);
89 }
std::vector< std::string > _string_data
Definition: GEM.H:105
GEM_UserData _solver_data
Definition: GEM.H:307

Here is the caller graph for this function:

bool TRAIL_FluReadDIM ( GEM_Partition gp,
double  t = 0.0,
bool  unsteady = true 
)

Definition at line 459 of file RocfluFunctions.C.

References GEM_Partition::_db, GEM_Partition::_debug, GEM_Partition::_hexconn, GEM_Partition::_id, GEM_UserData::_int_data, GEM_Partition::_nc, GEM_Partition::_nghex, GEM_Partition::_ngnodes, GEM_Partition::_ngpris, GEM_Partition::_ngpyr, GEM_Partition::_ngtet, GEM_Partition::_out, GEM_Partition::_pb, GEM_Partition::_prisconn, GEM_Partition::_pyrconn, GEM_Partition::_solver_data, GEM_UserData::_string_data, GEM_Partition::_tetconn, and SkipLines().

460 {
461  if(gp._debug && gp._out)
462  *gp._out << "TRAIL_FluReadDIM: Entry" << "\n";
463  if(gp._solver_data._string_data.size() < 3){
464  if(gp._out)
465  *gp._out << "TRAIL_FluReadDIM::Error: No casename or path found."
466  << std::endl;
467  return(false);
468  }
469  string pre(gp._solver_data._string_data[1] + "/" +
470  gp._solver_data._string_data[0]);
471  ifstream Inf;
472  ostringstream Ostr;
473  Ostr << pre << ".dim_";
474  Ostr << setw(5) << setfill('0');
475  Ostr << gp._id;
476  string filebase(Ostr.str());
477  if(unsteady){
478  Ostr.clear();
479  Ostr.str("");
480  Ostr << "_" << scientific << setprecision(5) << t;
481  string timestring(Ostr.str());
482  timestring.replace(8,1,"E");
483  filebase+=timestring;
484  }
485  Inf.open(filebase.c_str());
486  if(!Inf){
487  if(gp._debug && gp._out)
488  *gp._out << "TRAIL_FluReadDIM: Unable to open " << filebase
489  << " for reading." << endl;
490  return(false);
491  }
492  string line;
493  unsigned int nreal_cells = 0;
494  unsigned int ncells = 0;
495  unsigned int npatches = 0;
496  unsigned int nreal_tets = 0;
497  unsigned int nreal_hex = 0;
498  unsigned int nreal_pris = 0;
499  unsigned int nreal_pyr = 0;
500  unsigned int nreal_nodes = 0;
501  unsigned int ntet = 0;
502  unsigned int nhex = 0;
503  unsigned int npris = 0;
504  unsigned int npyr = 0;
505  unsigned int nnodes = 0;
506  SkipLines(Inf,2);
507  Inf >> nreal_nodes >> nnodes;
508  SkipLines(Inf,2);
509  Inf >> nreal_cells >> ncells;
510  SkipLines(Inf,2);
511  Inf >> nreal_tets >> ntet;
512  SkipLines(Inf,2);
513  Inf >> nreal_hex >> nhex;
514  SkipLines(Inf,2);
515  Inf >> nreal_pris >> npris;
516  SkipLines(Inf,2);
517  Inf >> nreal_pyr >> npyr;
518  SkipLines(Inf,2);
519  unsigned int nelem = ntet + nhex + npyr + npris;
520  Inf >> npatches >> gp._solver_data._int_data[1][0]; // npatches_total
521  gp._ngnodes = nnodes - nreal_nodes;
522  gp._ngtet = ntet - nreal_tets;
523  gp._nghex = nhex - nreal_hex;
524  gp._ngpyr = npyr - nreal_pyr;
525  gp._ngpris = npris - nreal_pris;
526  assert(nelem == ncells);
527  if(gp._debug && gp._out)
528  *gp._out << "TRAIL_FluReadDIM: Elems: (" << nelem << ","
529  << gp._ngtet+gp._nghex+gp._ngpyr+gp._ngpris << ")" << endl
530  << "TRAIL_FluReadDIM: Nodes: (" << nnodes << ","
531  << gp._ngnodes << ")" << endl
532  << "TRAIL_FluReadDIM: Patches: (" << npatches << ","
533  << gp._solver_data._int_data[1][0] << ")" << endl;
534  gp._db.resize(npatches);
535  gp._tetconn.resize(4*ntet);
536  gp._hexconn.resize(8*nhex);
537  gp._prisconn.resize(6*npris);
538  gp._pyrconn.resize(5*npyr);
539  gp._nc.resize(3*nnodes);
540  vector<GEM_DomainBoundary>::iterator fpi = gp._db.begin();
541  while(fpi != gp._db.end()){
542  unsigned int nreal_tri = 0;
543  unsigned int nreal_quad = 0;
544  unsigned int ntri = 0;
545  unsigned int nquad = 0;
546  Inf >> fpi->_id >> nreal_tri >> ntri >> nreal_quad >> nquad;
547  fpi->_ngtri = ntri - nreal_tri;
548  fpi->_ngquad = nquad - nreal_quad;
549  fpi->_triconn.resize(ntri*3);
550  fpi->_quadconn.resize(nquad*4);
551  fpi++;
552  }
553  unsigned int nborders = 0;
554  SkipLines(Inf,2);
555  Inf >> nborders;
556  if(gp._debug && gp._out)
557  *gp._out << "TRAIL_FluReadDIM: Number of borders: " << nborders
558  << endl;
559  gp._pb.resize(nborders);
560  gp._solver_data._int_data[0].resize(nborders);
561  unsigned int pbindex = 0;
562  vector<GEM_PartitionBoundary>::iterator fbi = gp._pb.begin();
563  while(fbi != gp._pb.end()){
564  unsigned int nsend,nrecv,nshared,csend,crecv;
565  Inf >> fbi->_rpart
566  >> gp._solver_data._int_data[0][pbindex++] >> csend >> crecv
567  >> nsend >> nrecv >> nshared;
568  if(gp._debug && gp._out)
569  *gp._out << "TRAIL_FluReadDIM: Border: ("
570  << fbi->_rpart << ","
571  << gp._solver_data._int_data[0][pbindex - 1] << ","
572  << csend << "," << crecv << "," << nsend << "," << nrecv
573  << "," << nshared << ")" << endl;
574  fbi->_sharenodes.resize(nshared);
575  fbi->_sendnodes.resize(nsend);
576  fbi->_recvnodes.resize(nrecv);
577  fbi->_sendcells.resize(csend);
578  fbi->_recvcells.resize(crecv);
579  fbi++;
580  }
581  Inf.close();
582  if(gp._debug && gp._out)
583  *gp._out << "TRAIL_FluReadDIM: Exit" << endl;
584  return(true);
585 }
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
std::vector< std::vector< int > > _int_data
Definition: GEM.H:100
std::vector< std::string > _string_data
Definition: GEM.H:105
unsigned int _ngnodes
Definition: GEM.H:286
unsigned int _ngpris
Definition: GEM.H:290
unsigned int _id
Definition: GEM.H:284
std::vector< GEM_DomainBoundary > _db
Definition: GEM.H:305
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< GEM_PartitionBoundary > _pb
Definition: GEM.H:304
bool _debug
Definition: GEM.H:310
unsigned int _ngtet
Definition: GEM.H:287
GEM_UserData _solver_data
Definition: GEM.H:307
istream & SkipLines(istream &, unsigned int=1)
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:

bool TRAIL_FluReadGridASCII ( GEM_Partition gp,
double  t = 0.0,
bool  unsteady = true 
)

Definition at line 1431 of file RocfluFunctions.C.

References GEM_Partition::_db, GEM_Partition::_debug, GEM_Partition::_hexconn, GEM_Partition::_id, GEM_Partition::_nc, GEM_Partition::_out, GEM_Partition::_prisconn, GEM_Partition::_pyrconn, GEM_DomainBoundary::_quadconn, GEM_Partition::_solver_data, GEM_UserData::_string_data, GEM_Partition::_tetconn, GEM_DomainBoundary::_triconn, i, and SkipLines().

1432 {
1433  if(gp._solver_data._string_data.size() < 3 ||
1434  gp._solver_data._string_data[0].empty() ||
1435  gp._solver_data._string_data[1].empty()){
1436  if(gp._out)
1437  *gp._out << "TRAIL_FluReadGridASCII:Error: solver data has no casename"
1438  << " or path." << std::endl;
1439  return 0;
1440  }
1441  string pre(gp._solver_data._string_data[1]+ "/" +
1442  gp._solver_data._string_data[0]);
1443  ostringstream Ostr;
1444  Ostr << pre << ".grda_" << setw(5) << setfill('0') << gp._id;
1445  string filebase(Ostr.str());
1446  Ostr.clear();
1447  Ostr.str("");
1448  Ostr << "_" << scientific << setprecision(5) << t;
1449  string timestring(Ostr.str());
1450  timestring.replace(8,1,"E");
1451  if(unsteady) filebase+=timestring;
1452  ifstream Inf;
1453  Inf.open(filebase.c_str());
1454  if(!Inf){
1455  if(gp._debug && gp._out)
1456  *gp._out << "TRAIL_FluReadGridASCII: Unable to open " << filebase
1457  << " for reading.\n";
1458  return(false);
1459  }
1460  string line;
1461  SkipLines(Inf,6);
1462  unsigned int nnode,ntet,nhex,npris,npyr;
1463  Inf >> nnode >> ntet >> nhex >> npris >> npyr;
1464  assert(nnode == gp._nc.size()/3 &&
1465  ntet == gp._tetconn.size()/4 &&
1466  nhex == gp._hexconn.size()/8 &&
1467  npris == gp._prisconn.size()/6 &&
1468  npyr == gp._pyrconn.size()/5);
1469  SkipLines(Inf,2);
1470  for(int i = 0; i < 3;i++){
1471  unsigned int node = 0;
1472  while(node < nnode)
1473  Inf >> gp._nc[(node++)*3+i];
1474  }
1475  if(ntet > 0){
1476  gp._tetconn.resize(ntet*4);
1477  SkipLines(Inf,2);
1478  for(int i = 0;i < 4;i++){
1479  unsigned int el = 0;
1480  while(el < ntet)
1481  Inf >> gp._tetconn[(el++)*4+i];
1482  }
1483  }
1484  if(nhex > 0){
1485  gp._hexconn.resize(nhex*8);
1486  SkipLines(Inf,2);
1487  for(int i = 0;i < 8;i++){
1488  unsigned int el = 0;
1489  while(el < nhex)
1490  Inf >> gp._hexconn[(el++)*8+i];
1491  }
1492  }
1493  if(npris > 0){
1494  gp._prisconn.resize(npris*6);
1495  SkipLines(Inf,2);
1496  for(int i = 0;i < 6;i++){
1497  unsigned int el = 0;
1498  while(el < npris)
1499  Inf >> gp._prisconn[(el++)*6+i];
1500  }
1501  }
1502  if(npyr > 0){
1503  gp._pyrconn.resize(npyr*5);
1504  SkipLines(Inf,2);
1505  for(int i = 0;i < 5;i++){
1506  unsigned int el = 0;
1507  while(el < npyr)
1508  Inf >> gp._pyrconn[(el++)*5+i];
1509  }
1510  }
1511  SkipLines(Inf,2);
1512  unsigned int npatches = 0;
1513  unsigned int patch = 0;
1514  Inf >> npatches;
1515  assert(npatches == gp._db.size());
1516  while(patch < npatches){
1517  GEM_DomainBoundary &fp = gp._db[patch++];
1518  unsigned int ntri,nquad;
1519  Inf >> ntri >> nquad;
1520  // assert(ntri == fp._ntri && nquad == fp._nquad);
1521  if(ntri > 0){
1522  fp._triconn.resize(3*ntri);
1523  for(int i = 0;i < 3;i++){
1524  unsigned int tri = 0;
1525  while(tri < ntri)
1526  Inf >> fp._triconn[(tri++)*3+i];
1527  }
1528  }
1529  if(nquad > 0){
1530  fp._quadconn.resize(4*nquad);
1531  for(int i = 0;i < 4;i++){
1532  unsigned int quad = 0;
1533  while(quad < nquad)
1534  Inf >> fp._quadconn[(quad++)*4+i];
1535  }
1536  }
1537  }
1538  Inf.close();
1539  return true;
1540 }
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
std::vector< std::string > _string_data
Definition: GEM.H:105
std::vector< unsigned int > _quadconn
Definition: GEM.H:132
Definition: adj.h:150
Definition: patch.h:74
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
std::vector< unsigned int > _pyrconn
Definition: GEM.H:297
blockLoc i
Definition: read.cpp:79
std::vector< unsigned int > _hexconn
Definition: GEM.H:301
bool _debug
Definition: GEM.H:310
GEM_UserData _solver_data
Definition: GEM.H:307
istream & SkipLines(istream &, unsigned int=1)
std::vector< double > _nc
Definition: GEM.H:293
std::vector< unsigned int > _prisconn
Definition: GEM.H:299

Here is the call graph for this function:

bool TRAIL_FluRegisterSurfMesh ( GEM_Partition gp)

Definition at line 1290 of file RocfluFunctions.C.

References GEM_Partition::_db, GEM_DomainBoundary::_ngquad, GEM_DomainBoundary::_ngtri, GEM_DomainBoundary::_quadconn, GEM_DomainBoundary::_triconn, COM_INT, COM_new_attribute(), COM_set_array(), COM_set_size(), GEM_DomainBoundary::pane_id, and GEM_Partition::surface_window.

Referenced by main(), and TRAIL_RemeshWrite().

1291 {
1292  COM_new_attribute((gp.surface_window+".t3g:real"),'p',COM_INT,3,"");
1293  COM_new_attribute((gp.surface_window+".t3g:virtual"),'p',COM_INT,3,"");
1294  COM_new_attribute((gp.surface_window+".q4g:real"),'p',COM_INT,4,"");
1295  COM_new_attribute((gp.surface_window+".q4g:virtual"),'p',COM_INT,4,"");
1296 
1297  vector<GEM_DomainBoundary>::iterator fpi = gp._db.begin();
1298  while(fpi != gp._db.end()){
1299  GEM_DomainBoundary &fp = *fpi++;
1300  unsigned int nreal = fp._triconn.size()/3 - fp._ngtri;
1301  if(nreal > 0){
1302  COM_set_size((gp.surface_window+".t3g:real"),fp.pane_id,nreal);
1303  COM_set_array((gp.surface_window+".t3g:real"),fp.pane_id,
1304  &(fp._triconn[0]),3);
1305  }
1306  nreal = fp._quadconn.size()/4 - fp._ngquad;
1307  if(nreal > 0){
1308  COM_set_size((gp.surface_window+".q4g:real"),fp.pane_id,nreal);
1309  COM_set_array((gp.surface_window+".q4g:real"),fp.pane_id,
1310  &(fp._quadconn[0]),4);
1311  }
1312  if(fp._ngtri > 0){
1313  nreal = fp._triconn.size()/3 - fp._ngtri;
1314  COM_set_size((gp.surface_window+".t3g:virtual"),fp.pane_id,
1315  fp._ngtri,fp._ngtri);
1316  COM_set_array((gp.surface_window+".t3g:virtual"),fp.pane_id,
1317  &(fp._triconn[nreal*3]),3);
1318  }
1319  if(fp._ngquad > 0){
1320  nreal = fp._quadconn.size()/4 - fp._ngquad;
1321  COM_set_size((gp.surface_window+".q4g:virtual"),fp.pane_id,
1322  fp._ngquad,fp._ngquad);
1323  COM_set_array((gp.surface_window+".q4g:virtual"),fp.pane_id,
1324  &(fp._quadconn[nreal*4]),4);
1325  }
1326  }
1327  return(true);
1328 }
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 > _quadconn
Definition: GEM.H:132
std::vector< unsigned int > _triconn
Definition: GEM.H:131
std::vector< GEM_DomainBoundary > _db
Definition: GEM.H:305
unsigned int _ngquad
Definition: GEM.H:129
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
std::string surface_window
Definition: GEM.H:319
unsigned int _ngtri
Definition: GEM.H:128

Here is the call graph for this function:

Here is the caller graph for this function:

bool TRAIL_FluRegisterSurfSoln ( GEM_DomainBoundary db,
const std::string &  wname,
bool  all = true 
)

Definition at line 1183 of file RocfluFunctions.C.

References GEM_DomainBoundary::_data, GEM_DomainBoundary::_debug, GEM_UserData::_field_data, GEM_DomainBoundary::_id, GEM_UserData::_int_data, GEM_DomainBoundary::_out, COM_set_array(), COM_set_size(), GEM_DomainBoundary::Create_com_surfsoln(), and GEM_DomainBoundary::pane_id.

Referenced by main(), TRAIL_FluRegisterSurfSoln(), and TRAIL_RemeshWrite().

1184 {
1185  if(db._debug && db._out)
1186  *db._out << "TRAIL_FluRegisterSoln: "
1187  << "Registering pane " << db.pane_id << "." << endl;
1188  if(db._data._field_data[0].size() != 0){
1189  COM_set_array((wname+".gs"),db.pane_id,&(db._data._field_data[0][0]));
1190  }
1191  COM_set_size((wname+".patchNo"),db.pane_id,1);
1192  COM_set_array((wname+".patchNo"),db.pane_id,&db._id);
1193  COM_set_size((wname+".bcflag"),db.pane_id,1);
1194  COM_set_array((wname+".bcflag"),db.pane_id,&db._data._int_data[1][0]);
1195  COM_set_size((wname+".cnstr_type"),db.pane_id,1);
1196  COM_set_array((wname+".cnstr_type"),db.pane_id,&db._data._int_data[2][0]);
1197  if(db._data._int_data[0].size() > 0)
1198  COM_set_array((wname+".bflag"),db.pane_id,&(db._data._int_data[0]));
1199  if(all){
1200  db.Create_com_surfsoln(wname,"rhofvf_alp",db._data._field_data[1],
1201  3,"kg/(m^2s)");
1202  db.Create_com_surfsoln(wname,"nf_alp",db._data._field_data[2],3,"");
1203  db.Create_com_surfsoln(wname,"rhof_alp",db._data._field_data[3],
1204  1,"kg/m^3");
1205  db.Create_com_surfsoln(wname,"pf",db._data._field_data[4],1,"Pa");
1206  db.Create_com_surfsoln(wname,"qc",db._data._field_data[5],1,"W/m^2");
1207  db.Create_com_surfsoln(wname,"qr",db._data._field_data[6],1,"W/m^2");
1208  db.Create_com_surfsoln(wname,"tf",db._data._field_data[7],3,"Pa");
1209  db.Create_com_surfsoln(wname,"Tb_alp",db._data._field_data[8],1,"K");
1210  db.Create_com_surfsoln(wname,"mdot_alp",db._data._field_data[9],
1211  1,"kg/(m^2s)");
1212  db.Create_com_surfsoln(wname,"Tflm_alp",db._data._field_data[10],1,"K");
1213  db.Create_com_surfsoln(wname,"Tf",db._data._field_data[11],1,"K");
1214  db.Create_com_surfsoln(wname,"vs",db._data._field_data[13],3,"m/s");
1215  db.Create_com_surfsoln(wname,"vs_old",db._data._field_data[14],3,"m/s");
1216  db.Create_com_surfsoln(wname,"ts",db._data._field_data[15],1,"Pa");
1217  db.Create_com_surfsoln(wname,"mdot",db._data._field_data[16],
1218  1,"kg/(m^2s)");
1219  db.Create_com_surfsoln(wname,"mdot_old",db._data._field_data[17],
1220  1,"kg/(m^2s)");
1221  // Nodal Data
1222  if(db._data._field_data[19].size() > 0)
1223  COM_set_array((wname+".nc_t0"),db.pane_id,&db._data._field_data[19][0]);
1224  if(db._data._field_data[18].size() > 0)
1225  COM_set_array((wname+".du_alp"),db.pane_id,&db._data._field_data[18][0]);
1226  if(db._data._field_data[12].size() > 0)
1227  COM_set_array((wname+".vm"),db.pane_id,&db._data._field_data[12][0]);
1228  if(db._data._field_data[20].size() > 0)
1229  COM_set_array((wname+".sq_dist"),db.pane_id,
1230  &db._data._field_data[20][0]);
1231 
1232  }
1233  return(true);
1234 }
void Create_com_surfsoln(const std::string &wname, const std::string &fname, std::vector< double > &fvec, unsigned int ncomp, const std::string &unit)
Definition: GEM.C:426
std::vector< std::vector< int > > _int_data
Definition: GEM.H:100
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< std::vector< double > > _field_data
Definition: GEM.H:95
unsigned int _id
Definition: GEM.H:127
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
GEM_UserData _data
Definition: GEM.H:137
std::ostream * _out
Definition: GEM.H:140

Here is the call graph for this function:

Here is the caller graph for this function:

bool TRAIL_FluRegisterSurfSoln ( GEM_Partition gp,
bool  all = true 
)

Definition at line 1237 of file RocfluFunctions.C.

References GEM_Partition::_db, GEM_Partition::_debug, GEM_Partition::_out, COM_DOUBLE, COM_INT, COM_new_attribute(), GEM_Partition::surface_window, and TRAIL_FluRegisterSurfSoln().

1238 {
1239 
1240  if(gp._debug && gp._out)
1241  *gp._out << "TRAIL_FluRegisterSurfSoln Enter"
1242  << endl;
1243  COM_new_attribute((gp.surface_window+".gs"),'e',COM_DOUBLE,1,"m/s");
1244  COM_new_attribute((gp.surface_window+".bcflag"),'p',COM_INT,1,"");
1245  COM_new_attribute((gp.surface_window+".cnstr_type"),'p',COM_INT,1,"");
1246  COM_new_attribute((gp.surface_window+".patchNo"),'p',COM_INT,1,"");
1247  COM_new_attribute((gp.surface_window+".bflag"),'e',COM_INT,1,"");
1248  if(all){
1249  COM_new_attribute(gp.surface_window+".rhofvf_alp",'e',
1250  COM_DOUBLE,3,"kg/(m^2s)");
1251  COM_new_attribute(gp.surface_window+".nf_alp",'e',COM_DOUBLE,3,"");
1252  COM_new_attribute(gp.surface_window+".rhof_alp",'e',COM_DOUBLE,1,"kg/m^3");
1253  COM_new_attribute(gp.surface_window+".pf",'e',COM_DOUBLE,1,"Pa");
1254  COM_new_attribute(gp.surface_window+".qc",'e',COM_DOUBLE,1,"W/m^2");
1255  COM_new_attribute(gp.surface_window+".qr",'e',COM_DOUBLE,1,"W/m^2");
1256  COM_new_attribute(gp.surface_window+".tf",'e',COM_DOUBLE,3,"Pa");
1257  COM_new_attribute(gp.surface_window+".Tb_alp",'e',COM_DOUBLE,1,"K");
1258  COM_new_attribute(gp.surface_window+".mdot_alp",'e',COM_DOUBLE,1,
1259  "kg/(m^2s)");
1260  COM_new_attribute(gp.surface_window+".Tflm_alp",'e',COM_DOUBLE,1,"K");
1261  COM_new_attribute(gp.surface_window+".Tf",'e',COM_DOUBLE,1,"K");
1262  COM_new_attribute(gp.surface_window+".ts",'e',COM_DOUBLE,1,"Pa");
1263  COM_new_attribute(gp.surface_window+".mdot",'e',COM_DOUBLE,1,"kg/(m^2s)");
1264  COM_new_attribute(gp.surface_window+".mdot_old",'e',COM_DOUBLE,1,
1265  "kg/(m^2s)");
1266  COM_new_attribute(gp.surface_window+".vs",'e',COM_DOUBLE,3,"m/s");
1267  COM_new_attribute(gp.surface_window+".vs_old",'e',COM_DOUBLE,3,"m/s");
1268 
1269  // Nodal data
1270  COM_new_attribute((gp.surface_window+".nc_t0"),'n',COM_DOUBLE,3,"m");
1271  COM_new_attribute((gp.surface_window+".vm"),'n',COM_DOUBLE,3,"m/s");
1272  COM_new_attribute((gp.surface_window+".sq_dist"),'n',COM_DOUBLE,1,"m");
1273  COM_new_attribute((gp.surface_window+".du_alp"),'n',COM_DOUBLE,3,"m");
1274  }
1275  vector<GEM_DomainBoundary>::iterator fpi = gp._db.begin();
1276  if(gp._debug && gp._out)
1277  *gp._out << "TRAIL_FluRegisterSurfSoln: "
1278  << "Registering domain boundaries..." << endl;
1279  while(fpi != gp._db.end()){
1280  GEM_DomainBoundary &fp = *fpi++;
1282  }
1283  if(gp._debug && gp._out)
1284  *gp._out << "TRAIL_FluRegisterSurfSoln: "
1285  << "Registering domain boundaries done." << endl;
1286  return(true);
1287 }
std::vector< GEM_DomainBoundary > _db
Definition: GEM.H:305
std::ostream * _out
Definition: GEM.H:308
bool TRAIL_FluRegisterSurfSoln(GEM_DomainBoundary &db, const std::string &wname, bool all=true)
bool _debug
Definition: GEM.H:310
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
std::string surface_window
Definition: GEM.H:319

Here is the call graph for this function:

bool TRAIL_FluRegisterVolSoln ( GEM_Partition gp,
bool  all = true 
)

Definition at line 1166 of file RocfluFunctions.C.

References GEM_Partition::_data, GEM_UserData::_field_data, GEM_Partition::_nvface, COM_DOUBLE, COM_new_attribute(), COM_set_array(), COM_set_size(), GEM_Partition::Create_com_volsoln(), GEM_Partition::pane_id, and GEM_Partition::volume_window.

Referenced by main(), and TRAIL_RemeshWrite().

1167 {
1168  gp.Create_com_volsoln("rhof",gp._data._field_data[2],1,"kg/m^3");
1169  gp.Create_com_volsoln("rhovf",gp._data._field_data[3],3,"kg/(m^2s)");
1170  gp.Create_com_volsoln("rhoEf",gp._data._field_data[4],1,"J/m^3");
1171  COM_new_attribute((gp.volume_window+".gs"),'p',COM_DOUBLE,1,"m/s");
1172  COM_set_size((gp.volume_window+".gs"),gp.pane_id,gp._nvface);
1173  if(gp._data._field_data[9].size() != 0)
1174  COM_set_array((gp.volume_window+".gs"),gp.pane_id,
1175  &(gp._data._field_data[9][0]));
1176  gp.Create_com_volsoln("pf",gp._data._field_data[5],1,"Pa");
1177  gp.Create_com_volsoln("Tf",gp._data._field_data[6],1,"K");
1178  gp.Create_com_volsoln("af",gp._data._field_data[7],1,"m/s");
1179  return(true);
1180 }
GEM_UserData _data
Definition: GEM.H:306
void Create_com_volsoln(const std::string &fname, std::vector< double > &fvec, unsigned int ncomp, const std::string &unit)
Definition: GEM.C:413
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< std::vector< double > > _field_data
Definition: GEM.H:95
unsigned int _nvface
Definition: GEM.H:291
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:

void TRAIL_FluResizeSurfSoln ( GEM_DomainBoundary db)

Definition at line 938 of file RocfluFunctions.C.

References GEM_DomainBoundary::_data, GEM_DomainBoundary::_debug, GEM_UserData::_field_data, GEM_UserData::_int_data, GEM_DomainBoundary::_out, GEM_DomainBoundary::_quadconn, GEM_UserData::_stride_field, GEM_UserData::_stride_int, GEM_DomainBoundary::_triconn, and GEM_DomainBoundary::NNodes().

Referenced by TRAIL_FluInitSurfSoln().

939 {
940  unsigned int nfaces = db._triconn.size()/3 + db._quadconn.size()/4;
941  unsigned int nvert = db.NNodes();
942  if(db._debug && db._out)
943  *db._out << "TRAIL_FluResizeSurfSoln: Resizing with " << nfaces << " faces"
944  << " and " << nvert << " vertices." << std::endl;
945  db._data._field_data.resize(21);
946  db._data._stride_field.resize(21);
947  db._data._int_data.resize(3);
948  db._data._stride_int.resize(3);
949  db._data._int_data[1].resize(1); // bcflag
950  db._data._stride_int[1] = 1;
951  db._data._int_data[2].resize(1); // cnstr_type
952  db._data._stride_int[2] = 1;
953  db._data._field_data[0].resize(nfaces,0.0); // gsp
954  db._data._stride_field[0] = 1;
955  db._data._field_data[1].resize(3*nfaces,0.0); // rhofvf_alp
956  db._data._stride_field[1] = 3;
957  db._data._field_data[2].resize(3*nfaces,0.0); // nf_alp
958  db._data._stride_field[2] = 3;
959  db._data._field_data[3].resize(nfaces,0.0); // rhof_alp
960  db._data._stride_field[3] = 1;
961  db._data._field_data[4].resize(nfaces,0.0); // pf
962  db._data._stride_field[4] = 1;
963  db._data._field_data[5].resize(nfaces,0.0); // qc
964  db._data._stride_field[5] = 1;
965  db._data._field_data[6].resize(nfaces,0.0); // qr
966  db._data._stride_field[6] = 1;
967  db._data._field_data[7].resize(3*nfaces,0.0); // tf
968  db._data._stride_field[7] = 3;
969  db._data._field_data[8].resize(nfaces,0.0); // Tb_alp
970  db._data._stride_field[8] = 1;
971  db._data._field_data[9].resize(nfaces,0.0); // mdot_alp
972  db._data._stride_field[9] = 1;
973  db._data._field_data[10].resize(nfaces,0.0); // Tflm_alp
974  db._data._stride_field[10] = 1;
975  db._data._int_data[0].resize(nfaces,0); // bflag
976  db._data._stride_int[0] = 1;
977  db._data._field_data[11].resize(nfaces,0.0); // Tf
978  db._data._stride_field[11] = 1;
979  db._data._field_data[12].resize(3*nvert,0.0); // vm
980  db._data._stride_field[12] = 3;
981  db._data._field_data[13].resize(3*nfaces,0.0); // vs
982  db._data._stride_field[13] = 3;
983  db._data._field_data[14].resize(3*nfaces,0.0); // vs_old
984  db._data._stride_field[14] = 3;
985  db._data._field_data[15].resize(nfaces,0.0); // ts
986  db._data._stride_field[15] = 1;
987  db._data._field_data[16].resize(nfaces,0.0); // mdot
988  db._data._stride_field[16] = 1;
989  db._data._field_data[17].resize(nfaces,0.0); // mdot_old
990  db._data._stride_field[17] = 1;
991  db._data._field_data[18].resize(nvert*3,0.0); // du_alp
992  db._data._stride_field[18] = 3;
993  db._data._field_data[19].resize(3*nvert,0.0); // nc_t0
994  db._data._stride_field[19] = 3;
995  db._data._field_data[20].resize(nvert,0.0); // sq_dist
996  db._data._stride_field[20] = 1;
997  if(db._debug && db._out)
998  *db._out << "TRAIL_FluResizeSurfSoln: Resizing done." << std::endl;
999 }
std::vector< std::vector< int > > _int_data
Definition: GEM.H:100
unsigned int NNodes(void)
Definition: GEM.C:1103
std::vector< unsigned int > _quadconn
Definition: GEM.H:132
std::vector< std::vector< double > > _field_data
Definition: GEM.H:95
std::vector< int > _stride_int
Definition: GEM.H:104
std::vector< unsigned int > _triconn
Definition: GEM.H:131
std::vector< int > _stride_field
Definition: GEM.H:103
GEM_UserData _data
Definition: GEM.H:137
std::ostream * _out
Definition: GEM.H:140

Here is the call graph for this function:

Here is the caller graph for this function:

void TRAIL_FluResizeVolSoln ( GEM_Partition gp)

Definition at line 785 of file RocfluFunctions.C.

References GEM_Partition::_data, GEM_Partition::_debug, GEM_UserData::_field_data, GEM_Partition::_hexconn, GEM_UserData::_int_data, GEM_Partition::_nc, GEM_Partition::_nvface, GEM_Partition::_out, GEM_Partition::_prisconn, GEM_Partition::_pyrconn, GEM_UserData::_stride_field, GEM_UserData::_stride_int, and GEM_Partition::_tetconn.

Referenced by TRAIL_FluInitVolSoln().

786 {
787  unsigned int ncells = gp._tetconn.size()/4 + gp._prisconn.size()/6 +
788  gp._pyrconn.size()/5 + gp._hexconn.size()/8;
789  unsigned int nnodes = gp._nc.size()/3;
790  unsigned int nvfaces = gp._nvface;
791  if(gp._debug && gp._out)
792  *gp._out << "TRAIL_FluResizeVolSoln: Allocating for " << ncells << " cells"
793  << ", " << nnodes << " nodes and " << nvfaces << " volume faces."
794  << std::endl;
795  gp._data._int_data.resize(1);
796  gp._data._stride_int.resize(1);
797  gp._data._int_data[0].resize(1); // unsteady flag
798  gp._data._int_data[0][0] = 1; // unsteady yes
799  gp._data._field_data.resize(10);
800  gp._data._stride_field.resize(10);
801  gp._data._field_data[0].resize(1); // _current_time
802  gp._data._stride_field[0] = 1;
803  gp._data._field_data[0][0] = 0.0;
804  gp._data._field_data[1].resize(1); // _residual
805  gp._data._field_data[1][0] = 0.0;
806  gp._data._stride_field[1] = 1;
807  gp._data._field_data[2].resize(ncells,0.0); // rhof
808  gp._data._stride_field[2] = 1;
809  gp._data._field_data[3].resize(3*ncells,0.0); // rhovf
810  gp._data._stride_field[3] = 3;
811  gp._data._field_data[4].resize(ncells,0.0); //rhoEf
812  gp._data._stride_field[4] = 1;
813  gp._data._field_data[5].resize(ncells,0.0); // pf
814  gp._data._stride_field[5] = 1;
815  gp._data._field_data[6].resize(ncells,0.0); // Tf
816  gp._data._stride_field[6] = 1;
817  gp._data._field_data[7].resize(ncells,0.0); // af
818  gp._data._stride_field[7] = 1;
819  gp._data._field_data[8].resize(nnodes*3,0.0); // disp
820  gp._data._stride_field[8] = 3;
821  gp._data._field_data[9].resize(nvfaces,0.0); // gridspeeds
822  gp._data._stride_field[9] = 1;
823  if(gp._debug && gp._out)
824  *gp._out << "TRAIL_FluResizeVolSoln: Volume data allocated." << std::endl;
825 }
GEM_UserData _data
Definition: GEM.H:306
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
std::vector< std::vector< int > > _int_data
Definition: GEM.H:100
std::vector< std::vector< double > > _field_data
Definition: GEM.H:95
std::vector< int > _stride_int
Definition: GEM.H:104
unsigned int _nvface
Definition: GEM.H:291
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
std::vector< double > _nc
Definition: GEM.H:293
std::vector< unsigned int > _prisconn
Definition: GEM.H:299

Here is the caller graph for this function:

bool TRAIL_FluWriteCMP ( GEM_Partition gp,
const std::string &  path 
)

Definition at line 709 of file RocfluFunctions.C.

References GEM_Partition::_hexconn, GEM_Partition::_id, GEM_Partition::_out, GEM_Partition::_prisconn, GEM_Partition::_pyrconn, GEM_Partition::_solver_data, GEM_UserData::_string_data, GEM_Partition::_tetconn, and GEM_Partition::Elem2Cell().

Referenced by TRAIL_FluWriteNative().

710 {
711  if(gp._solver_data._string_data.size() < 3){
712  if(gp._out)
713  *gp._out << "TRAIL_FluWriteCMP:Error: No casename or path found."
714  << std::endl;
715  return(false);
716  }
717  std::string pre("./" + path + "/" + gp._solver_data._string_data[0]);
718  std::ofstream Ouf;
719  std::ostringstream Ostr;
720  Ostr << pre << ".cmp_";
721  Ostr << setw(5) << setfill('0');
722  Ostr << gp._id;
723  Ouf.open(Ostr.str().c_str());
724  if(!Ouf)
725  return(false);
726  unsigned int ntet = gp._tetconn.size()/4;
727  unsigned int nhex = gp._hexconn.size()/8;
728  unsigned int npris = gp._prisconn.size()/6;
729  unsigned int npyr = gp._pyrconn.size()/5;
730  // BuildCellMapping();
731  Ouf << "# ROCFLU cell mapping file" << endl
732  << "# Dimensions" << endl
733  << setw(8) << ntet << setw(8) << nhex << setw(8) << npris
734  << setw(8) << npyr << endl;
735  // vector<pair<unsigned int,unsigned int> >::iterator ci = _cellmap.begin();
736  // int line = 0;
737  unsigned int el = 0;
738  unsigned int npl = 10;
739  if(ntet > 0){
740  el = 0;
741  Ouf << "# Tetrahedra" << endl;
742  while(el < ntet){
743  Ouf << setw(8) << gp.Elem2Cell(make_pair(1,++el));
744  if(!(el%npl))
745  Ouf << endl;
746  }
747  if(el%npl) Ouf << endl;
748  }
749  if(nhex > 0){
750  el = 0;
751  Ouf << "# Hexahedra" << endl;
752  while(el < nhex){
753  Ouf << setw(8) << gp.Elem2Cell(make_pair(4,++el));
754  if(!(el%npl))
755  Ouf << endl;
756  }
757  if(el%npl) Ouf << endl;
758  }
759  if(npris > 0){
760  el = 0;
761  Ouf << "# Prisms" << endl;
762  while(el < npris){
763  Ouf << setw(8) << gp.Elem2Cell(make_pair(3,++el));
764  if(!(el%npl))
765  Ouf << endl;
766  }
767  if(el%npl) Ouf << endl;
768  }
769  if(npyr > 0){
770  el = 0;
771  Ouf << "# Pyramids" << endl;
772  while(el<npyr){
773  Ouf << setw(8) << gp.Elem2Cell(make_pair(2,++el));
774  if(!(el%npl))
775  Ouf << endl;
776  }
777  if(el%npl) Ouf << endl;
778  }
779  Ouf << "# End" << endl;
780  Ouf.close();
781  return(true);
782 }
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
std::vector< std::string > _string_data
Definition: GEM.H:105
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
GEM_UserData _solver_data
Definition: GEM.H:307
std::vector< unsigned int > _prisconn
Definition: GEM.H:299

Here is the call graph for this function:

Here is the caller graph for this function:

bool TRAIL_FluWriteCOM ( GEM_Partition gp,
const std::string &  path 
)

Definition at line 92 of file RocfluFunctions.C.

References GEM_Partition::_id, GEM_UserData::_int_data, GEM_Partition::_out, GEM_Partition::_pb, GEM_Partition::_solver_data, GEM_UserData::_string_data, and ni.

Referenced by TRAIL_FluWriteNative().

93 {
94  if(gp._solver_data._string_data.size() < 3){
95  if(gp._out)
96  *gp._out << "TRAIL_FluWriteCOM::Error: No casename or path found."
97  << std::endl;
98  return(false);
99  }
100  string pre("./" + path + "/" + gp._solver_data._string_data[0]);
101  if(gp._solver_data._int_data.empty()){
102  if(gp._out)
103  *gp._out
104  << "TRAIL_FluWriteCOM: Error, called with empty rbid's."
105  << endl;
106  return(false);
107  }
108  assert(gp._solver_data._int_data[0].size() == gp._pb.size());
109  ofstream Ouf;
110  ostringstream Ostr;
111  Ostr << pre << ".com_";
112  Ostr << setw(5) << setfill('0');
113  Ostr << gp._id;
114  Ouf.open(Ostr.str().c_str());
115  if(!Ouf){
116  if(gp._out)
117  *gp._out
118  << "TRAIL_FluWriteCOM: Error: Could not open " << Ostr.str() << "."
119  << std::endl;
120  return(false);
121  }
122  Ouf << "# ROCFLU communication lists file" << endl
123  << "# Dimensions" << endl
124  << setw(8) << gp._pb.size() << endl
125  << "# Information" << endl;
126  int pbindex = 0;
127  vector<GEM_PartitionBoundary>::iterator fbi = gp._pb.begin();
128  while(fbi != gp._pb.end()){
129  Ouf << setw(8) << fbi->_rpart << setw(8)
130  << gp._solver_data._int_data[0][pbindex++]
131  << endl;
132  fbi++;
133  }
134  Ouf << "# Cells" << endl;
135  fbi = gp._pb.begin();
136  while(fbi != gp._pb.end()){
137  Ouf << setw(8) << fbi->_sendcells.size() << setw(8)
138  << fbi->_recvcells.size() << endl;
139  int line = 0;
140  vector<unsigned int>::iterator sci = fbi->_sendcells.begin();
141  while(sci != fbi->_sendcells.end()){
142  Ouf << setw(8) << *sci++;
143  line++;
144  if(line == 10){
145  Ouf << endl;
146  line = 0;
147  }
148  }
149  if(line){
150  Ouf << endl;
151  line = 0;
152  }
153  sci = fbi->_recvcells.begin();
154  while(sci != fbi->_recvcells.end()){
155  Ouf << setw(8) << *sci++;
156  line++;
157  if(line == 10){
158  Ouf << endl;
159  line = 0;
160  }
161  }
162  if(line){
163  Ouf << endl;
164  line = 0;
165  }
166  fbi++;
167  }
168  Ouf << "# Vertices" << endl;
169  fbi = gp._pb.begin();
170  while(fbi != gp._pb.end()){
171  Ouf << setw(8) << fbi->_sendnodes.size() << setw(8)
172  << fbi->_recvnodes.size() << setw(8) << fbi->_sharenodes.size()
173  << endl;
174  vector<unsigned int>::iterator ni = fbi->_sendnodes.begin();
175  int line = 0;
176  while(ni != fbi->_sendnodes.end()){
177  Ouf << setw(8) << *ni++;
178  line++;
179  if(line == 10){
180  Ouf << endl;
181  line = 0;
182  }
183  }
184  if(line || fbi->_sendnodes.empty()){
185  Ouf << endl;
186  line = 0;
187  }
188  ni = fbi->_recvnodes.begin();
189  line = 0;
190  while(ni != fbi->_recvnodes.end()){
191  Ouf << setw(8) << *ni++;
192  line++;
193  if(line == 10){
194  Ouf << endl;
195  line = 0;
196  }
197  }
198  if(line || fbi->_recvnodes.empty()){
199  Ouf << endl;
200  line = 0;
201  }
202  ni = fbi->_sharenodes.begin();
203  line = 0;
204  while(ni != fbi->_sharenodes.end()){
205  Ouf << setw(8) << *ni++;
206  line++;
207  if(line == 10){
208  Ouf << endl;
209  line = 0;
210  }
211  }
212  if(line || fbi->_sharenodes.empty()){
213  Ouf << endl;
214  line = 0;
215  }
216  fbi++;
217  }
218  Ouf << "# End" << endl;
219  return(true);
220 }
std::vector< std::vector< int > > _int_data
Definition: GEM.H:100
std::vector< std::string > _string_data
Definition: GEM.H:105
unsigned int _id
Definition: GEM.H:284
std::ostream * _out
Definition: GEM.H:308
std::vector< GEM_PartitionBoundary > _pb
Definition: GEM.H:304
GEM_UserData _solver_data
Definition: GEM.H:307
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77

Here is the caller graph for this function:

bool TRAIL_FluWriteDIM ( GEM_Partition gp,
double  t = 0.0,
bool  unsteady = true,
const std::string &  path = "./" 
)

Definition at line 365 of file RocfluFunctions.C.

References GEM_Partition::_db, GEM_Partition::_hexconn, GEM_Partition::_id, GEM_UserData::_int_data, GEM_Partition::_nc, GEM_Partition::_nghex, GEM_Partition::_ngnodes, GEM_Partition::_ngpris, GEM_Partition::_ngpyr, GEM_Partition::_ngtet, GEM_Partition::_out, GEM_Partition::_pb, GEM_Partition::_prisconn, GEM_Partition::_pyrconn, GEM_Partition::_solver_data, GEM_UserData::_string_data, and GEM_Partition::_tetconn.

Referenced by TRAIL_FluWriteNative().

367 {
368  if(gp._solver_data._string_data.size() < 3){
369  if(gp._out)
370  *gp._out << "TRAIL_FluWriteDIM::Error: No casename or path found."
371  << std::endl;
372  return(false);
373  }
374  std::string pre("./" + path + "/" + gp._solver_data._string_data[0]);
375  std::ofstream Ouf;
376  std::ostringstream Ostr;
377  Ostr << pre << ".dim_";
378  Ostr << setw(5) << setfill('0');
379  Ostr << gp._id;
380  std::string filebase(Ostr.str());
381  if(unsteady){
382  Ostr.clear();
383  Ostr.str("");
384  Ostr << "_" << scientific << setprecision(5) << t;
385  std::string timestring(Ostr.str());
386  timestring.replace(8,1,"E");
387  filebase+=timestring;
388  }
389  Ouf.open(filebase.c_str());
390  if(!Ouf){
391  if(gp._out)
392  *gp._out << "TRAIL_FluWriteDIM::Error: Could not open " << filebase << "."
393  << std::endl;
394  return(false);
395  }
396  unsigned int ntet = gp._tetconn.size()/4;
397  unsigned int nnodes = gp._nc.size()/3;
398  unsigned int nhex = gp._hexconn.size()/8;
399  unsigned int npris = gp._prisconn.size()/6;
400  unsigned int npyr = gp._pyrconn.size()/5;
401  unsigned int nelem = ntet + nhex + npris + npyr;
402  Ouf << "# ROCFLU dimensions file" << endl
403  << "# Vertices" << endl
404  << setw(8) << nnodes - gp._ngnodes << setw(8) << nnodes
405  << setw(8) << nnodes+(nnodes/5) << endl
406  << "# Cells" << endl
407  << setw(8) << (nelem-gp._ngtet-gp._ngpyr-gp._ngpris-gp._nghex)
408  << setw(8) << nelem
409  << setw(8) << (nelem+(nelem/5)) << endl
410  << "# Tetrahedra" << endl
411  << setw(8) << ntet - gp._ngtet << setw(8) << ntet << setw(8)
412  << (ntet+(ntet/5))
413  << endl
414  << "# Hexahedra" << endl
415  << setw(8) << nhex - gp._nghex << setw(8) << nhex << setw(8)
416  << (nhex+(nhex/5))
417  << endl
418  << "# Prisms" << endl
419  << setw(8) << npris - gp._ngpris << setw(8) << npris << setw(8)
420  << npris+(npris/5)
421  << endl
422  << "# Pyramids" << endl
423  << setw(8) << npyr - gp._ngpyr << setw(8) << npyr
424  << setw(8) << npyr+(npyr/5)
425  << endl
426  << "# Patches" << endl
427  << setw(8) << gp._db.size() << setw(8)
428  << gp._solver_data._int_data[1][0] << endl; // total_num_patches
429  vector<GEM_DomainBoundary>::iterator fpi = gp._db.begin();
430  while(fpi != gp._db.end()){
431  Ouf << setw(8) << fpi->_id << setw(8)
432  << fpi->_triconn.size()/3 - fpi->_ngtri
433  << setw(8) << fpi->_triconn.size()/3 << setw(8)
434  << fpi->_quadconn.size()/4 - fpi->_ngquad
435  << setw(8) << fpi->_quadconn.size()/4 << endl;
436  fpi++;
437  }
438  Ouf << "# Borders" << endl
439  << setw(8) << gp._pb.size() << endl;
440  vector<GEM_PartitionBoundary>::iterator fbi = gp._pb.begin();
441  unsigned int pbindex = 0;
442  assert(gp._solver_data._int_data[0].size() == gp._pb.size());
443  while(fbi != gp._pb.end()){
444  Ouf << setw(8) << fbi->_rpart << setw(8)
445  << gp._solver_data._int_data[0][pbindex++]
446  << setw(8)
447  << fbi->_sendcells.size() << setw(8) << fbi->_recvcells.size()
448  << setw(8)
449  << fbi->_sendnodes.size() << setw(8) << fbi->_recvnodes.size()
450  << setw(8)
451  << fbi->_sharenodes.size() << endl;
452  fbi++;
453  }
454  Ouf << "# End" << endl;
455  return(true);
456 }
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
std::vector< std::vector< int > > _int_data
Definition: GEM.H:100
std::vector< std::string > _string_data
Definition: GEM.H:105
unsigned int _ngnodes
Definition: GEM.H:286
unsigned int _ngpris
Definition: GEM.H:290
unsigned int _id
Definition: GEM.H:284
std::vector< GEM_DomainBoundary > _db
Definition: GEM.H:305
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< GEM_PartitionBoundary > _pb
Definition: GEM.H:304
unsigned int _ngtet
Definition: GEM.H:287
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
unsigned int _ngpyr
Definition: GEM.H:289
unsigned int _nghex
Definition: GEM.H:288

Here is the caller graph for this function:

bool TRAIL_FluWriteMAP ( GEM_Partition gp,
unsigned int  nproc,
unsigned int  nregions,
const std::string &  path 
)

Definition at line 319 of file RocfluFunctions.C.

References GEM_Partition::_out, GEM_Partition::_solver_data, and GEM_UserData::_string_data.

Referenced by main().

321 {
322  if(gp._solver_data._string_data.size() < 3){
323  if(gp._out)
324  *gp._out << "TRAIL_FluWriteMAP::Error: No casename or path found."
325  << std::endl;
326  return(false);
327  }
328  std::string pre("./" + path + "/" + gp._solver_data._string_data[0]);
329  ofstream Ouf;
330  ostringstream Ostr;
331  Ostr << pre << ".map";
332  Ouf.open(Ostr.str().c_str());
333  if(!Ouf)
334  return(false);
335  Ouf << "# ROCFLU region mapping file" << endl
336  << "# Number of regions" << endl
337  << setw(8) << nregions << endl
338  << "# Number of processes" << endl
339  << setw(8) << nproc << endl;
340  unsigned int regpproc = nregions/nproc;
341  if(regpproc == 0)
342  return(false);
343  unsigned int left = nregions%nproc;
344  unsigned int proc = 0;
345  unsigned int reg = 0;
346  while(proc < nproc){
347  unsigned int nreg = regpproc;
348  if(left > 0){
349  nreg++;
350  left--;
351  }
352  Ouf << "# Process " << setw(6) << setfill('0') << proc+1 << endl
353  << setfill(' ') << setw(8) << nreg << endl;
354  unsigned int uplimit = reg + nreg;
355  while(reg < uplimit)
356  Ouf << setw(8) << (1+reg++) << endl;
357  proc++;
358  }
359  Ouf << "# End" << endl;
360  Ouf.close();
361  return(true);
362 }
std::vector< std::string > _string_data
Definition: GEM.H:105
std::ostream * _out
Definition: GEM.H:308
GEM_UserData _solver_data
Definition: GEM.H:307

Here is the caller graph for this function:

bool TRAIL_FluWriteNative ( GEM_Partition gp,
const std::string &  path 
)

Definition at line 1396 of file RocfluFunctions.C.

References GEM_UserData::_int_data, GEM_Partition::_out, GEM_Partition::_pb, GEM_Partition::_solver_data, GEM_UserData::_stride_int, GEM_UserData::_string_data, TRAIL_FluWriteCMP(), TRAIL_FluWriteCOM(), and TRAIL_FluWriteDIM().

Referenced by main(), and TRAIL_RemeshWrite().

1397 {
1398  bool error = false;
1399  if(gp._solver_data._string_data.size() < 3)
1400  error = true;
1401  if(gp._solver_data._string_data[0].empty() ||
1402  gp._solver_data._string_data[1].empty())
1403  error = true;
1404  if(gp._solver_data._int_data.empty())
1405  error = true;
1406  if(error){
1407  if(gp._out)
1408  *(gp._out) << "TRAIL_FluWriteNative: Error. Called with empty"
1409  << " solver data." << endl;
1410  return false;
1411  }
1412  if(!TRAIL_FluWriteCMP(gp,path))
1413  error = true;
1414  if(gp._solver_data._int_data[0].empty()){
1415  gp._solver_data._int_data[0].resize(gp._pb.size(),0);
1416  gp._solver_data._stride_int[0] = gp._pb.size();
1417  }
1418  if(!TRAIL_FluWriteDIM(gp,0.0,true,path))
1419  error = true;
1420  if(!TRAIL_FluWriteCOM(gp,path))
1421  error = true;
1422  return(!error);
1423 }
bool TRAIL_FluWriteCOM(GEM_Partition &gp, const std::string &path)
std::vector< std::vector< int > > _int_data
Definition: GEM.H:100
std::vector< std::string > _string_data
Definition: GEM.H:105
bool TRAIL_FluWriteCMP(GEM_Partition &gp, const std::string &path)
std::vector< int > _stride_int
Definition: GEM.H:104
std::ostream * _out
Definition: GEM.H:308
std::vector< GEM_PartitionBoundary > _pb
Definition: GEM.H:304
GEM_UserData _solver_data
Definition: GEM.H:307
bool TRAIL_FluWriteDIM(GEM_Partition &gp, double t=0.0, bool unsteady=true, const std::string &path="./")

Here is the call graph for this function:

Here is the caller graph for this function: