Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RemeshFunctions.C
Go to the documentation of this file.
1 /* *******************************************************************
2  * Rocstar Simulation Suite *
3  * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4  * *
5  * Illinois Rocstar LLC *
6  * Champaign, IL *
7  * www.illinoisrocstar.com *
8  * sales@illinoisrocstar.com *
9  * *
10  * License: See LICENSE file in top level of distribution package or *
11  * http://opensource.org/licenses/NCSA *
12  *********************************************************************/
13 /* *******************************************************************
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17  * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21  * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22  *********************************************************************/
23 #include <iostream>
24 #include <fstream>
25 #include <string>
26 #include <list>
27 #include <map>
28 #include <sstream>
29 #include <iomanip>
30 #include <vector>
31 #include <cstdio>
32 #include <cassert>
33 
34 #include "TRAIL_UnixUtils.H"
35 
36 #include "mpi.h"
37 
38 #include "GEM.H"
39 #include "TRAIL.H"
40 #include "TRAIL_Flu.H"
41 #include "TRAIL_Remesh.H"
42 
43 #ifdef _ROCSTAR_X_
44 #include "roccom.h"
45 #endif
46 
47 COM_EXTERN_MODULE( Rocface);
51 COM_EXTERN_MODULE( Rocsurf);
52 
53 using namespace std;
54 
55 void
56 TRAIL_RemeshRunDirSetup(const std::string &path,double t,MPI_Comm comm,
57  bool shuffle)
58 {
59  int rank = 0;
60  MPI_Comm_rank(comm,&rank);
61 
62  std::string rocstarrundir(TRAIL_CWD());
63  std::string rocremdir("Rocrem");
64 
65  // For now, only these two are needed
66  std::string solver(path);
67  std::string rocman("Rocman");
68  std::string ddrocm("../"+rocman);
69  std::string rocburnapn("RocburnAPN");
70  std::string ddsolver("../"+solver);
71  std::string ddrocb("../"+rocburnapn);
72  struct stat fstat;
73  if(!rank){
74  if(stat(solver.c_str(),&fstat)){
75  std::cerr << "TRAIL_RemeshRunDirSetup: ERROR: Solver directory, "
76  << solver << ", does not exist. Exiting." << std::endl;
77  exit(1);
78  }
79  if(stat(rocremdir.c_str(),&fstat))
80  mkdir(rocremdir.c_str(),S_IRWXU | S_IRWXG);
81  }
82  chdir(rocremdir.c_str());
83  if(!rank){
84  unlink(solver.c_str());
85  symlink(ddsolver.c_str(),solver.c_str());
86  if(!stat(ddrocm.c_str(),&fstat)){
87  unlink(rocman.c_str());
88  symlink(ddrocm.c_str(),rocman.c_str());
89  }
90  if(!stat(ddrocb.c_str(),&fstat)){
91  unlink(rocburnapn.c_str());
92  symlink(ddrocb.c_str(),rocburnapn.c_str());
93  }
94  unlink("rocstardir");
95  symlink(rocstarrundir.c_str(),"rocstardir");
96  // if(shuffle)
97  // TRAIL_RemeshShuffle(solver,t);
98  }
99 }
100 
101 void
102 TRAIL_RemeshShutdown(MPI_Comm comm)
103 {
104  chdir("rocstardir");
105 }
106 
107 bool
109 {
110  unsigned int ndb = gp._db.size();
111  unsigned int n = 0;
112  if(!TRAIL_FluInitSurfSoln(gp))
113  return false;
114  while(n < ndb)
115  if(!TRAIL_RemeshInitFluSurfData(gp._db[n++],0))
116  return false;
117  return true;
118 }
119 
120 bool
122 {
123  if(db._debug && db._out)
124  *db._out << "TRAIL_RemeshInitFluSurfData:Enter" << std::endl;
125  unsigned int ntri = db._triconn.size()/3;
126  unsigned int nquad = db._quadconn.size()/4;
127  unsigned int nnodes = db.NNodes();
128  unsigned int n_elem = ntri + nquad;
129  if(db._debug && db._out)
130  *db._out << "TRAIL_RemeshInitFluSurfData: Ntri = " << ntri
131  << " Nquad = " << nquad << endl
132  << "TRAIL_RemeshInitFluSurfData: Solution sizes("
133  << nnodes << "," << n_elem << ")" << endl;
134  unsigned int ind = 0;
135  unsigned int cdind = 0;
136  unsigned int vind = 0;
137  // Deallocate unused datum
138  db._data._field_data[0].resize(0); // gsp's are 0 after remeshing
139  db._data._stride_field[0] = 0;
140  db._data._field_data[1].resize(0); // rhofvf_alp not used
141  db._data._stride_field[1] = 0;
142  db._data._field_data[2].resize(0); // nf_alp not used
143  db._data._stride_field[2] = 0;
144  db._data._field_data[3].resize(0); // rhof_alp not used
145  db._data._stride_field[3] = 0;
146  db._data._field_data[4].resize(0); // pf
147  db._data._stride_field[4] = 0;
148  db._data._field_data[5].resize(0); // qc
149  db._data._stride_field[5] = 0;
150  db._data._field_data[6].resize(0); // qr
151  db._data._stride_field[6] = 0;
152  db._data._field_data[7].resize(0); // tf
153  db._data._stride_field[7] = 0;
154  db._data._field_data[8].resize(0); // Tb_alp
155  db._data._stride_field[8] = 0;
156  db._data._field_data[11].resize(0); // Tf
157  db._data._stride_field[11] = 0;
158  db._data._field_data[12].resize(0); // vm
159  db._data._stride_field[12] = 0;
160  db._data._field_data[13].resize(0); // vs
161  db._data._stride_field[13] = 0;
162  db._data._field_data[14].resize(0); // vs_old
163  db._data._stride_field[14] = 0;
164  db._data._field_data[16].resize(0); // mdot
165  db._data._stride_field[16] = 0;
166  db._data._field_data[17].resize(0); // mdot_old
167  db._data._stride_field[17] = 0;
168  db._data._field_data[18].resize(0); // du_alp
169  db._data._stride_field[18] = 0;
170  db._data._field_data[20].resize(0); // sq_dist
171  db._data._stride_field[20] = 0;
172  if (db._solver_data._field_data.size() == 0){
173  db._data._field_data[9].resize(0);
174  db._data._field_data[10].resize(0);
175  db._data._field_data[15].resize(0);
176  db._data._int_data[0].resize(0);
177  db._data._field_data[19].resize(0);
178  }
179  else if((db._solver_data._stride_field[0] == 2 ||
180  db._solver_data._stride_field[0] == 3)) {
181  assert(db._solver_data._stride_field[1] == 0 ||
182  db._solver_data._stride_field[1] == 3);
183  db._data._int_data[0].resize(n_elem,0);
184  while(ind < n_elem){
185  // Keep mdot, Tflm, bflag, and ts
186  db._data._field_data[9][ind] =
187  db._solver_data._field_data[src_index][cdind++]; // mdot_alp
188  db._data._field_data[10][ind] =
189  db._solver_data._field_data[src_index][cdind++]; // Tflm_alp
190  if(db._data._field_data[9][0] > 0) // if faces on fire, set bflag
191  db._data._int_data[0][ind] = 1;
192  if(db._solver_data._stride_field[0] == 3)
193  db._data._field_data[15][ind] =
194  db._solver_data._field_data[src_index][cdind++]; // ts
195  // if(db_debug && db_out)
196  // *db_out << "Element[" << ind+1 << "] rhof_alp("
197  // << _soln._rhof_alp[ind] << ") _nf_alp<"
198  // << _soln._nf_alp[vind] << ","
199  // << _soln._nf_alp[vind+1] << ","
200  // << _soln._nf_alp[vind+2] << ">" << endl;
201  ind++;
202  vind+=3;
203  }
204  db._solver_data._field_data[src_index].resize(0);
205  db._solver_data._stride_field[src_index] = 0;
206  if(db._data._field_data[9][0] == -9999){
207  db._data._field_data[9].resize(0);
208  db._data._stride_field[9] = 0;
209  db._data._field_data[10].resize(0);
210  db._data._stride_field[10] = 0;
211  db._data._int_data[0].resize(0);
212  db._data._stride_int[0] = 0;
213  }
214  if(db._data._field_data[15][0] == -9999){
215  db._data._field_data[15].resize(0);
216  db._data._stride_field[15] = 0;
217  }
218  src_index++;
219  ind = 0;
220  cdind = 0;
221  if(db._solver_data._stride_field[1] == 3){
222  while(ind < nnodes){
223  db._data._field_data[19][ind*3] =
224  db._solver_data._field_data[src_index][cdind++]; // nc_t0-x
225  db._data._field_data[19][ind*3+1] =
226  db._solver_data._field_data[src_index][cdind++]; // nc_t0-y
227  db._data._field_data[19][ind*3+2] =
228  db._solver_data._field_data[src_index][cdind++]; // nc_t0-z
229  ind++;
230  }
231  }
232  db._solver_data._field_data[src_index].resize(0);
233  db._solver_data._stride_field[src_index] = 0;
234  if(db._data._field_data[19][0] == -9999){
235  db._data._field_data[19].resize(0);
236  db._data._stride_field[19] = 0;
237  }
238  }
239  else
240  if(db._debug && db._out)
241  *db._out << "TRAIL_RemeshInitFluSurfData: No data to process." << std::endl;
242  if(db._debug && db._out)
243  *db._out << "TRAIL_RemeshInitFluSurfData:Exit" << std::endl;
244  return(true);
245 }
246 
247 bool
249 {
250  // assert((gp._solver_data._stride_field[0] == 8) &&
251  // (gp._solver_data._stride_field[1] == 3 ||
252  // gp._solver_data._stride_field[1] == 0));
253  unsigned int ntet = gp._tetconn.size()/4;
254  unsigned int nhex = gp._hexconn.size()/8;
255  unsigned int npris = gp._prisconn.size()/6;
256  unsigned int npyr = gp._pyrconn.size()/5;
257  unsigned int nnodes = gp._nc.size()/3;
258  unsigned int ncells = ntet + nhex + npris + npyr;
259  // assert(gp._solver_data._field_data[src_index].size() == 8*ncells);
260  // assert(gp._solver_data._field_data[src_index+1].size() == 3*nnodes);
261  if(!TRAIL_FluInitVolSoln(gp))
262  return false;
263  unsigned int ind = 0;
264  unsigned int cdind = 0;
265  unsigned int vind = 0;
266  while(ind < ncells){
267  // rhof
268  gp._data._field_data[2][ind] =
269  gp._solver_data._field_data[src_index][cdind++];
270  // rhovf_x
271  gp._data._field_data[3][vind++] =
272  gp._solver_data._field_data[src_index][cdind++];
273  // rhovf_y
274  gp._data._field_data[3][vind++] =
275  gp._solver_data._field_data[src_index][cdind++];
276  // rhovf_z
277  gp._data._field_data[3][vind++] =
278  gp._solver_data._field_data[src_index][cdind++];
279  // rhoEf
280  gp._data._field_data[4][ind] =
281  gp._solver_data._field_data[src_index][cdind++];
282  // pf
283  gp._data._field_data[5][ind] =
284  gp._solver_data._field_data[src_index][cdind++];
285  // Tf
286  gp._data._field_data[6][ind] =
287  gp._solver_data._field_data[src_index][cdind++];
288  // af
289  gp._data._field_data[7][ind] =
290  gp._solver_data._field_data[src_index][cdind++];
291  ind++;
292  }
293  ind = 0;
294  gp._solver_data._field_data[src_index].resize(0);
295  gp._solver_data._stride_field[src_index] = 0;
296  src_index++;
297  // nodal displacements (disp)
298  if(gp._solver_data._field_data[src_index].size() == 3*nnodes){
299  while(ind < nnodes){
300  gp._data._field_data[8][ind*3] =
301  gp._solver_data._field_data[src_index][ind*3];
302  gp._data._field_data[8][ind*3+1] =
303  gp._solver_data._field_data[src_index][ind*3+1];
304  gp._data._field_data[8][ind*3+2] =
305  gp._solver_data._field_data[src_index][ind*3+2];
306  ind++;
307  }
308  }
309  else{
310  while(ind < nnodes){
311  gp._data._field_data[8][ind*3] = 0.0;
312  gp._data._field_data[8][ind*3+1] = 0.0;
313  gp._data._field_data[8][ind*3+2] = 0.0;
314  ind++;
315  }
316  }
317  // Grid speeds are 0 after remeshing
318  gp._data._field_data[9].resize(0);
319  gp._data._stride_field[9] = 0;
320  gp._solver_data._field_data[src_index].resize(0);
321  gp._solver_data._stride_field[src_index] = 0;
322  return(true);
323 }
324 
325 
326 void
327 TRAIL_RemeshFixRocstarFiles(GEM_Partition &gp,const std::string &path,double t)
328 {
329  // Read in all the files and output to a single Rocin control file
330  // Volume first:
331  // set up base filename
334 }
335 
336 bool
338  const std::string &src,
339  const std::string &srcpath,
340  const std::string &trgpath,
341  const std::string &destpath,
342  double t,
343  MPI_Comm comm)
344 {
345  std::string timestring(TRAIL_TimeString(t));
346  std::string srcfile(src + "_in_" + timestring + ".txt");
347  std::string trgfile(gp.surface_window+"_in_"+timestring+".txt");
348  std::string srcwin(src);
349  std::string trailwin(src+"_trail");
350  std::string trgwin(gp.surface_window);
351  std::string homedir(TRAIL_CWD());
352  std::string format("HDF");
353  std::string crpath(trgpath+"/AutoSurf");
354  struct stat fstat;
355  int rank = 0;
356  MPI_Comm_rank(comm,&rank);
357 
358  if(!rank){
359  if(!stat(crpath.c_str(),&fstat)){
360  rename(crpath.c_str(),(crpath+"_save").c_str());
361  std::cerr << "TRAIL_RemeshAutoSurfer: WARNING: " << crpath << " already "
362  << "existed. Renaming to " << crpath << "_save." << std::endl;
363  }
364  TRAIL_CreateDirectory(crpath);
365  }
366  MPI_Barrier(comm);
367  // Serial step to create the common refinement
368  if(gp._debug && gp._out)
369  *gp._out << "TRAIL_RemeshAutoSurfer: Creating overlay for coupled surfaces."
370  << std::endl;
371 
372  if(!rank)
373  TRAIL_AutoSurfer(srcwin,trgwin,srcpath,trgpath,crpath,t,comm,gp._out);
374  MPI_Barrier(comm);
375  if(gp._debug && gp._out)
376  *gp._out << "TRAIL_RemeshAutoSurfer: Overlay for coupled surfaces complete."
377  << std::endl
378  << "TRAIL_RemeshAutoSurfer: Transferring data....";
379  MPI_Barrier(comm);
380  if(!rank && gp._debug)
381  std::cout << "Roctrail> Transferring data in parallel..." << std::endl;
382 
383 
384  TRAIL_TransferSurfDataFILE(srcwin,trgwin,"new_surf",srcpath,trgpath,
385  destpath,crpath,t,gp._id,comm,gp._out);
386 
387 
388  if(gp._debug && gp._out)
389  *gp._out << "TRAIL_AutoSurfer: Transfer for coupled surfaces complete."
390  << std::endl
391  << "TRAIL_AutoSurfer: Writing populated surfaces."
392  << std::endl;
393  if(!rank && gp._debug)
394  std::cout << "Roctrail> Transfer done." << std::endl;
395 
396 
397  MPI_Barrier(comm);
398  return(true);
399 }
400 
401 // SERIAL- DO NOT INVOKE WITH MULTIPROCS
402 void
403 TRAIL_RemeshShuffle(const std::string &solver,double t,bool debug)
404 {
405  if(t==0.0)
406  return;
407  std::string timestring(TRAIL_TimeString(t));
408  std::string time0string(TRAIL_TimeString(0.0));
409  std::string ssd("Modin");
410  std::string rsd("Rocout");
411  std::string strg("Modin.remesh_"+timestring);
412  std::string strg0("Modin.remesh_"+time0string);
413  std::string rtrg("Rocout.remesh_"+timestring);
414  std::string rtrg0("Rocout.remesh_"+time0string);
415  std::string solversrc(solver+"/"+ssd);
416  std::string solvertrg0(solver+"/"+strg0);
417  std::string solvertrg(solver+"/"+strg);
418  std::string rocstarsrc(solver+"/"+rsd);
419  std::string rocstartrg(solver+"/"+rtrg);
420  std::string rocstartrg0(solver+"/"+rtrg0);
421  std::string rocstarlast(solver+"/Rocout.remesh_last");
422  std::string solverlast(solver+"/Modin.remesh_last");
423  struct stat fstat0;
424  struct stat fstat1;
425  if(lstat(rocstarsrc.c_str(),&fstat0)){
426  std::cerr << "TRAIL_Remesh::DirectoryShuffling: ERROR: " << rocstarsrc
427  << " does not exist. Exiting." << std::endl;
428  exit(1);
429  }
430  // If the <solver>/Rocout is a directory, then this must be the first remesh
431  // The plan is to mv <solver>/Rocout to <solver>/Rocout.remesh_00.000000
432  if(S_ISDIR(fstat0.st_mode)){
433  if(debug)
434  std::cout << "TRAIL_RemeshShuffle: " << rocstarsrc << " directory exists."
435  << std::endl;
436  // bummer, <solver>/Rocout.remesh_00.000000 already existed. this should
437  // probably never happen, but if it does, warn and back it up as
438  // <solver>/Rocout.remesh_save_00.000000
439  if(!stat(rocstartrg0.c_str(),&fstat1)){
440  std::string savepath(rocstarsrc+".remesh_save_"+time0string);
441  rename(rocstartrg0.c_str(),savepath.c_str());
442  std::cerr << "TRAIL_Remesh::DirectoryShuffling: WARNING: " << rocstartrg0
443  << " already existed. Saving it as " << savepath << "."
444  << std::endl;
445  }
446  rename(rocstarsrc.c_str(),rocstartrg0.c_str());
447  symlink(rtrg0.c_str(),rocstarsrc.c_str());
448  }
449  // <solver>/Rocout is not a directory, it is a link, that's okay unless it's
450  // already pointing at <solver>/Rocout.remesh_<timestamp>. In this case, the
451  // most likely scenario is the one where you are remeshing the same timestamp
452  // multiple times without running rocstar.
453  else{
454  std::string pointsto(ResolveLink(rocstarsrc.c_str()));
455  if(debug)
456  std::cout << "TRAIL_RemeshShuffle: " << rocstarsrc
457  << " is a link to " << pointsto << "." << std::endl;
458  if(pointsto == rtrg){
459  if(debug)
460  std::cout << "TRAIL_RemeshShuffle: " << rocstarsrc
461  << " directory did not exist." << std::endl;
462  if(stat(rocstarlast.c_str(),&fstat1) ||
463  stat(solverlast.c_str(),&fstat1)){
464  std::cerr << "TRAIL_Remesh::DirectoryShuffling: ERROR: Detected "
465  << "multiple remesh of same dump, but last source cannot "
466  << "be found. Exiting." << std::endl;
467  exit(1);
468  }
469  unlink(rocstarsrc.c_str());
470  rename(rocstarlast.c_str(),rocstarsrc.c_str());
471  unlink(solversrc.c_str());
472  rename(solverlast.c_str(),solversrc.c_str());
473  }
474  else{ // it points to the last remeshing
475  unlink(rocstarlast.c_str());
476  unlink(solverlast.c_str());
477  }
478  }
479  // If rocstartrg already exists, warn and back it up
480  if(!stat(rocstartrg.c_str(),&fstat0)){
481  std::string savepath(rocstarsrc+".remesh_save_"+timestring);
482  rename(rocstartrg.c_str(),savepath.c_str());
483  std::cerr << "TRAIL_Remesh::DirectoryShuffling: WARNING: " << rocstartrg
484  << " already existed. Saving it as " << savepath << "."
485  << std::endl;
486  }
487  mkdir(rocstartrg.c_str(),S_IRWXG | S_IRWXU);
488  symlink(ResolveLink(rocstarsrc.c_str()).c_str(),rocstarlast.c_str());
489  if(lstat(solversrc.c_str(),&fstat0)){
490  std::cerr << "TRAIL_Remesh::DirectoryShuffling: ERROR: " << solversrc
491  << " does not exist. Exiting." << std::endl;
492  exit(1);
493  }
494  // If the <solver>/Modin is a directory, then this must be the first remesh
495  // The plan is to mv <solver>/Modin to <solver>/Modin.remesh_00.000000
496  if(S_ISDIR(fstat0.st_mode)){
497  // bummer, <solver>/Modin.remesh_00.000000 already existed. this should
498  // probably never happen, but if it does, warn and back it up as
499  // <solver>/Modin.remesh_save_00.000000
500  if(!stat(solvertrg0.c_str(),&fstat1)){
501  std::string savepath(solversrc+".remesh_save_"+time0string);
502  rename(solvertrg0.c_str(),savepath.c_str());
503  std::cerr << "TRAIL_Remesh::DirectoryShuffling: WARNING: " << solvertrg0
504  << " already existed. Saving it as " << savepath << "."
505  << std::endl;
506  }
507  rename(solversrc.c_str(),solvertrg0.c_str());
508  symlink(strg0.c_str(),solversrc.c_str());
509  }
510  // If solvertrg already exists, warn and back it up
511  if(!stat(solvertrg.c_str(),&fstat0)){
512  std::string savepath(solversrc+".remesh_save_"+timestring);
513  rename(solvertrg.c_str(),savepath.c_str());
514  std::cerr << "TRAIL_Remesh::DirectoryShuffling: WARNING: " << solvertrg
515  << " already existed. Saving it as " << savepath << "."
516  << std::endl;
517  }
518  mkdir(solvertrg.c_str(),S_IRWXG | S_IRWXU);
519  symlink(ResolveLink(solversrc.c_str()).c_str(),solverlast.c_str());
520  // Deal with RocburnAPN
521  std::string rocburnapn("RocburnAPN");
522  std::string rocburnapnsrc(rocburnapn+"/"+rsd);
523  std::string rocburnapntrg0(rocburnapn+"/"+rtrg0);
524  std::string rocburnapntrg(rocburnapn+"/"+rtrg);
525  if(!lstat(rocburnapnsrc.c_str(),&fstat0)){
526  if(S_ISDIR(fstat0.st_mode)){
527  if(!stat(rocburnapntrg0.c_str(),&fstat1)){
528  // RocburnAPN/Rocout is a directory, but RocburnAPN/Rocout.remesh_0
529  // already exists. Warn and back up the previous one.
530  std::string savepath(rocburnapnsrc+".remesh_save_"+time0string);
531  rename(rocburnapntrg0.c_str(),savepath.c_str());
532  std::cerr << "TRAIL_Remesh::DirectoryShuffling: WARNING: "
533  << rocburnapntrg0 << " already existed, backup it up as "
534  << savepath << "." << std::endl;
535  }
536  rename(rocburnapnsrc.c_str(),rocburnapntrg0.c_str());
537  symlink(rtrg0.c_str(),rocburnapnsrc.c_str());
538  }
539  if(!stat(rocburnapntrg.c_str(),&fstat1)){
540  // RocburnAPN/Rocout.remesh_<timestamp> already exists, warn and back it
541  // up.
542  std::string savepath(rocburnapnsrc+".remesh_save_"+timestring);
543  rename(rocburnapntrg.c_str(),savepath.c_str());
544  std::cerr << "TRAIL_Remesh::DirectoryShuffling: WARNING: "
545  << rocburnapntrg << " already existed, backup it up as "
546  << savepath << "." << std::endl;
547  }
548  mkdir(rocburnapntrg.c_str(), S_IRWXG | S_IRWXU);
549  unlink(rocburnapnsrc.c_str());
550  symlink(rtrg.c_str(),rocburnapnsrc.c_str());
551  }
552 }
553 
554 // bool
555 // TRAIL_RemeshWrite(GEM_Partition &gp,const string &path,double t,MPI_Comm comm,
556 // bool transfer_surface_data)
557 // {
558 // transfer_surface_data = false;
559 // std::string homedir(CWD());
560 // std::string timestring(TRAIL_TimeString(t));
561 // std::string solver(path);
562 // std::string solversrc(solver+"/Modin");
563 // std::string strg("Modin.remesh_"+timestring);
564 // std::string solvertrg(solver+"/"+strg);
565 // std::string rocstarsrc(solver+"/Rocout");
566 // std::string rtrg("Rocout.remesh_"+timestring);
567 // std::string rocstartrg(solver+"/"+rtrg);
568 // std::string volcntl("remesh_vol_in_"+timestring+".txt");
569 // std::string surfcntl("remesh_surf_in_"+timestring+".txt");
570 // std::string fluvolcntl(rocstarsrc+"/fluid_in_"+timestring+".txt");
571 // std::string flusurfcntl(rocstarsrc+"/ifluid_in_"+timestring+".txt");
572 // COM_set_profiling(0);
573 // int rank = 0;
574 // MPI_Comm_rank(comm,&rank);
575 // int nproc = 0;
576 // MPI_Comm_size(comm,&nproc);
577 // gp._npart = nproc;
578 // // if(!rank)
579 // // DirectoryShuffling(path,t);
580 // // transfer_surface_data = true;
581 // if(comm != MPI_COMM_WORLD && gp._out)
582 // *gp._out << "TRAIL_RemeshWrite: WARNING: communicator is "
583 // << (comm == MPI_COMM_NULL ? "null." : "not worldly.")
584 // << std::endl;
585 // if(gp._debug && gp._out)
586 // *gp._out << "TRAIL_RemeshWrite: Preparing to write remeshed dataset for "
587 // << path << "." << std::endl;
588 // MPI_Barrier(comm);
589 // if(!rank)
590 // std::cout << "Initializing solver data for " << path << "...";
591 // if(gp._debug){
592 // if(gp._out)
593 // *gp._out << "TRAIL_RemeshWrite: Window test..." << std::endl;
594 // MPI_Barrier(comm);
595 // string test("test");
596 // if(gp._out)
597 // *gp._out << " creation..." << std::endl;
598 // MPI_Barrier(comm);
599 // COM_new_window(test);
600 // MPI_Barrier(comm);
601 // if(gp._out)
602 // *gp._out << " destruction..." << std::endl;
603 // MPI_Barrier(comm);
604 // COM_delete_window(test);
605 // MPI_Barrier(comm);
606 // if(gp._out)
607 // *gp._out << "TRAIL_RemeshWrite: Window test passed, graduating..."
608 // << std::endl;
609 // }
610 // std::string pre(path+"/Rocout");
611 // // Write Rocflu remesh
612 // if(path == "Rocflu"){
613 
614 // // COM_delete_window("ifluid");
615 // if(gp._debug && gp._out)
616 // *gp._out << "TRAIL_RemeshWrite: Initializing solver data..." << std::endl;
617 // if(!TRAIL_FluInitSolver(gp,path))
618 // return(false);
619 // // Now that we have Rocflu's paths defined and target directories created,
620 // // we can copy in the necessary Rocflu casefiles from the solver source to
621 // // the solver target directories.
622 // TRAIL_FluCopyCaseFiles(gp,solvertrg);
623 // if(gp._debug && gp._out)
624 // *gp._out << "TRAIL_RemeshWrite: Solver data init done." << std::endl
625 // << "TRAIL_RemeshWrite: Writing native files (pass 1)..."
626 // << std::endl;
627 // if(!TRAIL_FluWriteNative(gp,solvertrg))
628 // return(false);
629 // MPI_Barrier(comm);
630 // if(gp._debug && gp._out)
631 // *gp._out << "TRAIL_RemeshWrite: Solver native files written (pass 1)."
632 // << std::endl
633 // << "TRAIL_RemeshWrite: Populating remote border indices..."
634 // << std::endl;
635 // MPI_Barrier(comm);
636 // if(!TRAIL_FluPopRemBordIndFILE(gp,0.0,true,solvertrg))
637 // return(false);
638 // MPI_Barrier(comm);
639 // if(gp._debug && gp._out)
640 // *gp._out << "TRAIL_RemeshWrite: Remote border indices populated."
641 // << std::endl
642 // << "TRAIL_RemeshWrite: Writing native files (pass 2)..."
643 // << std::endl;
644 // MPI_Barrier(comm);
645 // if(!TRAIL_FluWriteNative(gp,solvertrg))
646 // return(false);
647 // MPI_Barrier(comm);
648 // if(gp._debug && gp._out)
649 // *gp._out << "TRAIL_RemeshWrite: Solver native files written (pass 2)."
650 // << std::endl
651 // << "TRAIL_RemeshWrite: Initializing volume data..."
652 // << std::endl;
653 // MPI_Barrier(comm);
654 // if(!TRAIL_RemeshInitFluVolData(gp,0))
655 // return(false);
656 // MPI_Barrier(comm);
657 // if(gp._debug && gp._out)
658 // *gp._out << "TRAIL_RemeshWrite: Volume data initialized."
659 // << std::endl
660 // << "TRAIL_RemeshWrite: Initializing surface data..."
661 // << std::endl;
662 // MPI_Barrier(comm);
663 // if(!TRAIL_RemeshInitFluSurfData(gp))
664 // return(false);
665 // MPI_Barrier(comm);
666 // if(gp._debug && gp._out)
667 // *gp._out << "TRAIL_RemeshWrite: Surface data initialized."
668 // << std::endl
669 // << "TRAIL_RemeshWrite: Initializing Roccom Windows..."
670 // << std::endl;
671 // MPI_Barrier(comm);
672 // if(!rank)
673 // std::cout << "done." << std::endl
674 // << "Creating Roccom Windows...";
675 // if(!gp.InitRoccomWindows("remesh"))
676 // return(false);
677 // MPI_Barrier(comm);
678 // if(gp._debug && gp._out)
679 // *gp._out << "TRAIL_RemeshWrite: Roccom windows initialized."
680 // << std::endl
681 // << "TRAIL_RemeshWrite: Registering surface meshes..."
682 // << std::endl;
683 // MPI_Barrier(comm);
684 // if(!TRAIL_FluRegisterSurfMesh(gp))
685 // return(false);
686 // MPI_Barrier(comm);
687 // if(gp._debug && gp._out)
688 // *gp._out << "TRAIL_RemeshWrite: Surface meshes registered."
689 // << std::endl
690 // << "TRAIL_RemeshWrite: Registering volume solution..."
691 // << std::endl;
692 // MPI_Barrier(comm);
693 // if(!TRAIL_FluRegisterVolSoln(gp))
694 // return(false);
695 // MPI_Barrier(comm);
696 // if(gp._debug && gp._out)
697 // *gp._out << "TRAIL_RemeshWrite: Volume soln registered."
698 // << std::endl
699 // << "TRAIL_RemeshWrite: Registering surface solution..."
700 // << std::endl;
701 // MPI_Barrier(comm);
702 // if(!TRAIL_FluRegisterSurfSoln(gp))
703 // return(false);
704 // MPI_Barrier(comm);
705 // if(gp._debug && gp._out)
706 // *gp._out << "TRAIL_RemeshWrite: Surface soln registered."
707 // << std::endl
708 // << "TRAIL_RemeshWrite: Preparing to write..."
709 // << std::endl;
710 // MPI_Barrier(comm);
711 // if(!gp.WindowInitDone())
712 // return(false);
713 // if(!rank)
714 // std::cout << "done." << std::endl
715 // << "Writing windows to Rocstar format..."
716 // << std::endl;
717 // MPI_Barrier(comm);
718 // if(gp._debug && gp._out)
719 // *gp._out << " writing..." << std::endl;
720 // MPI_Barrier(comm);
721 // if(!gp.WriteRocstar(rocstartrg,t))
722 // return(false);
723 // MPI_Barrier(comm);
724 // gp.DestroyWindows();
725 // // Take care of the directory thing
726 // // Record the name of the real source directory for surface xfer
727 // // rm <solver>/Rocout link and relink to rocstartrg
728 // // rm <solver>/Modin link and relink to solvertrg
729 // if(!rank){
730 // // rename(rocstarsrc.c_str(),(solver+"/Rocout_old").c_str());
731 // unlink(rocstarsrc.c_str());
732 // symlink(rtrg.c_str(),rocstarsrc.c_str());
733 // unlink(solversrc.c_str());
734 // symlink(strg.c_str(),solversrc.c_str());
735 // };
736 // if(gp._debug && gp._out)
737 // *gp._out << " done writing" << std::endl;
738 // MPI_Barrier(comm);
739 // if(gp._debug && gp._out)
740 // *gp._out << "TRAIL_RemeshWrite: Merging Rocin files..." << std::endl;
741 // if(!rank){
742 // TRAIL_MergeRocinFiles(gp.volume_window,gp.volume_window,rocstartrg,t,gp._npart);
743 // TRAIL_MergeRocinFiles(gp.surface_window,gp.surface_window,rocstartrg,t,gp._npart);
744 // }
745 // TRAIL_RemeshFixRocstarFiles(gp,rocstartrg,t);
746 // if(gp._debug && gp._out)
747 // *gp._out << "TRAIL_RemeshWrite: Rocin files merged." << std::endl;
748 // MPI_Barrier(comm);
749 // if(!rank){
750 // symlink(volcntl.c_str(),fluvolcntl.c_str());
751 // symlink(surfcntl.c_str(),flusurfcntl.c_str());
752 // }
753 // if(transfer_surface_data){
754 // if(!rank)
755 // std::cout << "Proceeding with surface data transfer..." << std::endl;
756 // if(gp._debug && gp._out)
757 // *gp._out << "TRAIL_RemeshWrite: Testing surface transfer..."
758 // << std::endl;
759 // TRAIL_RemeshAutoSurfer(gp,"ifluid",(solver+"/Rocout.remesh_last"),
760 // rocstartrg,rocstartrg,t,comm);
761 // MPI_Barrier(comm);
762 // if(!rank){
763 // unlink(flusurfcntl.c_str());
764 // surfcntl.assign("new_surf_in_"+timestring+".txt");
765 // symlink(surfcntl.c_str(),flusurfcntl.c_str());
766 // }
767 // if(gp._debug && gp._out)
768 // *gp._out << "TRAIL_RemeshWrite: Surface transfer complete."
769 // << std::endl;
770 // MPI_Barrier(comm);
771 
772 // if(!rank)
773 // std::cout << "Surface data transfer succeeded." << std::endl;
774 // }
775 // // if(!rank)
776 // // unlink((solver+"/Rocout_old").c_str());
777 // MPI_Barrier(comm);
778 // if(gp._debug && gp._out)
779 // *gp._out << "TRAIL_RemeshWrite: All done." << std::endl
780 // << "TRAIL_RemeshWrite: Exit" << std::endl;
781 
782 // MPI_Barrier(comm);
783 // if(!rank)
784 // std::cout << "Rocstar restart data done." << std::endl;
785 // MPI_Barrier(comm);
786 // return(true);
787 // }
788 // if(gp._out)
789 // *gp._out << "TRAIL_RemeshWrite::Error: Unknown solver, " << path << "."
790 // << std::endl
791 // << (gp._debug ? "TRAIL_RemeshWrite: Exit" : "") << std::endl;
792 // return(false);
793 // }
794 bool
796  const std::string &solver,
797  const std::string &srcd,
798  const std::string &trgd,
799  double t,MPI_Comm comm,
800  bool surftrans,bool rocstarshuffle)
801 {
802  // transfer_surface_data = false;
803  std::string source_directory(srcd);
804  std::string target_directory(trgd);
805  std::string rocstarrunsrc("Rocout");
806  std::string defaultrocstartrg("Rocout.remesh_"+TRAIL_TimeString(t));
807  if(source_directory.empty())
808  source_directory = rocstarrunsrc;
809  if(target_directory.empty())
810  target_directory = defaultrocstartrg;
811  std::string homedir(TRAIL_CWD());
812  std::string timestring(TRAIL_TimeString(t));
813  std::string solversrc(solver+"/Modin");
814  std::string strg("Modin.remesh_"+timestring);
815  std::string solvertrg(solver+"/"+strg);
816  std::string rocstarsrc(solver+"/"+source_directory);
817  std::string rtrg(target_directory);
818  std::string rocstartrg(solver+"/"+rtrg);
819  std::string volcntl("remesh_vol_in_"+timestring+".txt");
820  std::string surfcntl("remesh_surf_in_"+timestring+".txt");
821  std::string fluvolcntl(rocstartrg+"/fluid_in_"+timestring+".txt");
822  std::string flusurfcntl(rocstartrg+"/ifluid_in_"+timestring+".txt");
823 
825  int rank = 0;
826  MPI_Comm_rank(comm,&rank);
827  int nproc = 0;
828  MPI_Comm_size(comm,&nproc);
829  gp._npart = nproc;
830  std::cout << flush;
831  MPI_Barrier(comm);
832  std::string rocstardir("..");
833  if(!rank){
834  TRAIL_CD(rocstardir,gp._out);
835  rocstardir.assign(TRAIL_CWD());
836  TRAIL_CD(homedir,gp._out);
837  }
838  std::string solverdir(rocstardir+"/"+solver);
839  if(!TRAIL_FILEEXISTS(rocstarsrc)){
840  if(!rank)
841  std::cerr << "TRAIL_RemeshWrite: Fatal Error: Source directory, "
842  << rocstarsrc << " does not exist. Exiting." << std::endl;
843  if(gp._out)
844  *gp._out << "TRAIL_RemeshWrite: Fatal Error: Souce directory, "
845  << rocstarsrc << " does not exist. Exiting." << std::endl;
846  exit(1);
847  }
848  if(!TRAIL_FILEEXISTS(solversrc)){
849  if(!rank)
850  std::cerr << "TRAIL_RemeshWrite: Fatal Error: Source directory, "
851  << solversrc << " does not exist. Exiting." << std::endl;
852  if(gp._out)
853  *gp._out << "TRAIL_RemeshWrite: Fatal Error: Souce directory, "
854  << solversrc << " does not exist. Exiting." << std::endl;
855  exit(1);
856  }
857  if(!TRAIL_FILEEXISTS(rocstartrg))
858  TRAIL_CreateDirectory(rocstartrg);
859  if(!TRAIL_FILEEXISTS(solvertrg))
860  TRAIL_CreateDirectory(solvertrg);
861  if(comm != MPI_COMM_WORLD && gp._out)
862  *gp._out << "TRAIL_RemeshWrite: WARNING: communicator is "
863  << (comm == MPI_COMM_NULL ? "null." : "not worldly.")
864  << std::endl;
865  if(gp._debug && gp._out)
866  *gp._out << "TRAIL_RemeshWrite: Preparing to write remeshed dataset for "
867  << solver << "." << std::endl;
868  MPI_Barrier(comm);
869  if(!rank)
870  std::cout << std::endl
871  << "Roctrail> Processing solver data for " << solver
872  << std::endl;
873  MPI_Barrier(comm);
874  if(gp._debug){
875  if(gp._out)
876  *gp._out << "TRAIL_RemeshWrite: Window test..." << std::endl;
877  MPI_Barrier(comm);
878  string test("test");
879  if(gp._out)
880  *gp._out << " creation..." << std::endl;
881  MPI_Barrier(comm);
882  COM_new_window(test);
883  MPI_Barrier(comm);
884  if(gp._out)
885  *gp._out << " destruction..." << std::endl;
886  MPI_Barrier(comm);
887  COM_delete_window(test);
888  MPI_Barrier(comm);
889  if(gp._out)
890  *gp._out << "TRAIL_RemeshWrite: Window test passed, graduating..."
891  << std::endl;
892  }
893  // Write Rocflu remesh
894  if(solver == "Rocflu"){
895 
896  // COM_delete_window("ifluid");
897  if(gp._debug && gp._out)
898  *gp._out << "TRAIL_RemeshWrite: Initializing solver data..." << std::endl;
899  if(!TRAIL_FluInitSolver(gp,solver))
900  return(false);
901  // Now that we have Rocflu's paths defined and target directories created,
902  // we can copy in the necessary Rocflu casefiles from the solver source to
903  // the solver target directories.
904  TRAIL_FluCopyCaseFiles(gp,solvertrg);
905  if(gp._debug && gp._out)
906  *gp._out << "TRAIL_RemeshWrite: Solver data init done." << std::endl
907  << "TRAIL_RemeshWrite: Writing native files (pass 1)..."
908  << std::endl;
909  if(!TRAIL_FluWriteNative(gp,solvertrg))
910  return(false);
911  MPI_Barrier(comm);
912  if(gp._debug && gp._out)
913  *gp._out << "TRAIL_RemeshWrite: Solver native files written (pass 1)."
914  << std::endl
915  << "TRAIL_RemeshWrite: Populating remote border indices..."
916  << std::endl;
917  MPI_Barrier(comm);
918  if(!TRAIL_FluPopRemBordIndFILE(gp,0.0,true,solvertrg))
919  return(false);
920  MPI_Barrier(comm);
921  if(gp._debug && gp._out)
922  *gp._out << "TRAIL_RemeshWrite: Remote border indices populated."
923  << std::endl
924  << "TRAIL_RemeshWrite: Writing native files (pass 2)..."
925  << std::endl;
926  MPI_Barrier(comm);
927  if(!TRAIL_FluWriteNative(gp,solvertrg))
928  return(false);
929  MPI_Barrier(comm);
930  if(gp._debug && gp._out)
931  *gp._out << "TRAIL_RemeshWrite: Solver native files written (pass 2)."
932  << std::endl
933  << "TRAIL_RemeshWrite: Initializing volume data..."
934  << std::endl;
935  MPI_Barrier(comm);
936  if(!TRAIL_RemeshInitFluVolData(gp,0))
937  return(false);
938  MPI_Barrier(comm);
939  if(gp._debug && gp._out)
940  *gp._out << "TRAIL_RemeshWrite: Volume data initialized."
941  << std::endl
942  << "TRAIL_RemeshWrite: Initializing surface data..."
943  << std::endl;
944  MPI_Barrier(comm);
946  return(false);
947  MPI_Barrier(comm);
948  if(gp._debug && gp._out)
949  *gp._out << "TRAIL_RemeshWrite: Surface data initialized."
950  << std::endl
951  << "TRAIL_RemeshWrite: Initializing Roccom Windows..."
952  << std::endl;
953  MPI_Barrier(comm);
954  if(!rank)
955  std::cout << "Roctrail> Creating Roccom Windows" << std::endl;
956  if(!gp.InitRoccomWindows("remesh"))
957  return(false);
958  MPI_Barrier(comm);
959  if(gp._debug && gp._out)
960  *gp._out << "TRAIL_RemeshWrite: Roccom windows initialized."
961  << std::endl
962  << "TRAIL_RemeshWrite: Registering surface meshes..."
963  << std::endl;
964  MPI_Barrier(comm);
966  return(false);
967  MPI_Barrier(comm);
968  if(gp._debug && gp._out)
969  *gp._out << "TRAIL_RemeshWrite: Surface meshes registered."
970  << std::endl
971  << "TRAIL_RemeshWrite: Registering volume solution..."
972  << std::endl;
973  MPI_Barrier(comm);
974  if(!TRAIL_FluRegisterVolSoln(gp))
975  return(false);
976  MPI_Barrier(comm);
977  if(gp._debug && gp._out)
978  *gp._out << "TRAIL_RemeshWrite: Volume soln registered."
979  << std::endl
980  << "TRAIL_RemeshWrite: Registering surface solution..."
981  << std::endl;
982  MPI_Barrier(comm);
984  return(false);
985  MPI_Barrier(comm);
986  if(gp._debug && gp._out)
987  *gp._out << "TRAIL_RemeshWrite: Surface soln registered."
988  << std::endl;
989  MPI_Barrier(comm);
990  if(!gp.WindowInitDone())
991  return(false);
992  if(!rank)
993  std::cout << "Roctrail> Writing windows to Rocstar format"
994  << std::endl;
995  MPI_Barrier(comm);
996  if(gp._debug && gp._out)
997  *gp._out << " writing..." << std::endl;
998  MPI_Barrier(comm);
999  if(!gp.WriteRocstar(rocstartrg,t))
1000  return(false);
1001  MPI_Barrier(comm);
1002  TRAIL_CD(homedir,gp._out);
1003  gp.DestroyWindows();
1004  if(gp._debug && gp._out)
1005  *gp._out << " done writing" << std::endl;
1006  MPI_Barrier(comm);
1007 
1008  // Set up Rocin Control Files for Rocstar
1009  if(rocstarshuffle){
1010  if(!rank){
1011  std::cout << "Roctrail> Setting up Rocin control files for Rocstar"
1012  << std::endl;
1013  if(!TRAIL_FILEEXISTS(fluvolcntl+".orig") && TRAIL_FILEEXISTS(fluvolcntl))
1014  rename(fluvolcntl.c_str(),(fluvolcntl+".orig").c_str());
1015  if(!TRAIL_FILEEXISTS(flusurfcntl+".orig") &&
1016  TRAIL_FILEEXISTS(flusurfcntl))
1017  rename(flusurfcntl.c_str(),(flusurfcntl+".orig").c_str());
1018  symlink(volcntl.c_str(),fluvolcntl.c_str());
1019  symlink(surfcntl.c_str(),flusurfcntl.c_str());
1020  }
1021  }
1022  if(surftrans){
1023  if(!rank)
1024  std::cout << "Roctrail> Proceeding with surface data transfer..."
1025  << std::endl;
1026  if(gp._debug && gp._out)
1027  *gp._out << "TRAIL_RemeshWrite: Performing surface data transfer..."
1028  << std::endl;
1029  TRAIL_RemeshAutoSurfer(gp,"ifluid",rocstarsrc,
1030  rocstartrg,rocstartrg,t,comm);
1031  MPI_Barrier(comm);
1032  // Reset Rocin Control Files for populated surface
1033  if(rocstarshuffle){
1034  if(!rank){
1035  std::cout << "Roctrail> Resetting Rocin control files"
1036  << std::endl;
1037  unlink(flusurfcntl.c_str());
1038  surfcntl.assign("new_surf_in_"+timestring+".txt");
1039  symlink(surfcntl.c_str(),flusurfcntl.c_str());
1040  }
1041  }
1042  if(!rank)
1043  std::cout << "Roctrail> Surface data transfer done." << std::endl;
1044  if(gp._debug && gp._out)
1045  *gp._out << "TRAIL_RemeshWrite: Surface transfer complete."
1046  << std::endl;
1047  MPI_Barrier(comm);
1048  }
1049  MPI_Barrier(comm);
1050  TRAIL_CD(homedir,gp._out);
1051  // Prepare Rocstar restart files
1052  if(rocstarshuffle){
1053  if(!rank){
1054  std::cout << "Roctrail> Preparing Rocstar restart directories."
1055  << std::endl;
1056  std::string rocstarbackup0(rocstardir+"/"+solver+
1057  "/Rocout.remesh_00.000000");
1058  if(rocstartrg != rocstarrunsrc){
1059  // <solver>/Rocout is an actual directory, back it up as
1060  // Rocout.remesh_00.000000
1061  if(TRAIL_ISDIR(solverdir+"/"+rocstarrunsrc) &&
1062  !TRAIL_ISLINK(solverdir+"/"+rocstarrunsrc)){
1063  TRAIL_SafeRemove(rocstarbackup0,".save");
1064  rename((solverdir+"/"+rocstarrunsrc).c_str(),
1065  rocstarbackup0.c_str());
1066  }
1067  else if(TRAIL_ISLINK(solverdir+"/"+rocstarrunsrc))
1068  unlink((solverdir+"/"+rocstarrunsrc).c_str());
1069  if(gp._debug)
1070  std::cout << "Roctrail> Attempting to link " << rocstarrunsrc
1071  << " to " << rtrg << "." << std::endl;
1072  symlink(rtrg.c_str(),(solverdir+"/"+rocstarrunsrc).c_str());
1073  // Modin is a directory, act accordingly
1074  std::string solverbackup0(rocstardir+"/"+solver+
1075  "/Modin.remesh_00.000000");
1076  if(TRAIL_ISDIR(rocstardir+"/"+solversrc) &&
1077  !TRAIL_ISLINK(rocstardir+"/"+solversrc)){
1078  TRAIL_SafeRemove(solverbackup0,".save");
1079  rename((rocstardir+"/"+solversrc).c_str(),solverbackup0.c_str());
1080  }
1081  else if(TRAIL_ISLINK(solversrc))
1082  unlink((rocstardir+"/"+solversrc).c_str());
1083  if(gp._debug)
1084  std::cout << "Roctrail> Attempting to link " << solversrc << " to "
1085  << strg << "." << std::endl;
1086  symlink(strg.c_str(),(rocstardir+"/"+solversrc).c_str());
1087  }
1088  }
1089  if(!rank)
1090  std::cout << "Roctrail> Rocstar restart data done." << std::endl;
1091  }
1092  if(gp._debug && gp._out)
1093  *gp._out << "TRAIL_RemeshWrite: All done." << std::endl
1094  << "TRAIL_RemeshWrite: Exit" << std::endl;
1095  if(!rank)
1096  std::cout << "Roctrail> Goodbye" << std::endl;
1097  MPI_Barrier(comm);
1098  return(true);
1099  }
1100  if(gp._out)
1101  *gp._out << "TRAIL_RemeshWrite::Error: Unknown solver, " << solver << "."
1102  << std::endl
1103  << (gp._debug ? "TRAIL_RemeshWrite: Exit" : "") << std::endl;
1104  return(false);
1105 }
1106 
1107 
1108 
1109 
1110 
1111 
1112 
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_COMM_WORLD
bool InitRoccomWindows(const std::string &wname)
Definition: GEM.C:685
GEM_UserData _data
Definition: GEM.H:306
bool TRAIL_FILEEXISTS(const std::string &fname)
void TRAIL_RemeshShutdown(MPI_Comm comm)
bool TRAIL_FluInitSolver(GEM_Partition &gp, const std::string &prefix="./")
void COM_delete_window(const char *wname)
Definition: roccom_c++.h:94
std::vector< unsigned int > _tetconn
Definition: GEM.H:295
std::vector< std::vector< int > > _int_data
Definition: GEM.H:100
bool TRAIL_TransferSurfDataFILE(const std::string &src, const std::string &trg, const std::string &dest, const std::string &srcpath, const std::string &trgpath, const std::string &destpath, const std::string &crpath, double t, unsigned int id, MPI_Comm comm, std::ostream *=NULL)
Definition: TRAIL.C:2620
This file contains the prototypes for Roccom API.
void TRAIL_AutoSurfer(const std::string &src, const std::string &trg, const std::string &srcpath=".", const std::string &trgpath=".", const std::string &destpath=".", double t=0, MPI_Comm comm=MPI_COMM_NULL, std::ostream *=NULL)
Definition: TRAIL.C:2544
unsigned int NNodes(void)
Definition: GEM.C:1103
int TRAIL_CD(const std::string &path, std::ostream *=NULL)
bool TRAIL_FluInitVolSoln(GEM_Partition &gp)
std::vector< unsigned int > _quadconn
Definition: GEM.H:132
bool TRAIL_ISDIR(const std::string &fname)
GEM_UserData _solver_data
Definition: GEM.H:138
unsigned int _npart
Definition: GEM.H:285
void TRAIL_SafeRemove(const std::string &fname, const std::string &ext)
bool WriteRocstar(const std::string &, double t=0.0)
Definition: GEM.C:601
std::vector< std::vector< double > > _field_data
Definition: GEM.H:95
bool TRAIL_FluInitSurfSoln(GEM_DomainBoundary &db, const std::string &, bool all=true)
std::vector< int > _stride_int
Definition: GEM.H:104
bool TRAIL_RemeshWrite(GEM_Partition &gp, const std::string &path, double t=0.0, MPI_Comm comm=MPI_COMM_NULL, bool=false)
std::string TRAIL_TimeString(double t)
Definition: TRAIL.C:85
bool TRAIL_FluRegisterSurfMesh(GEM_Partition &gp)
std::vector< unsigned int > _triconn
Definition: GEM.H:131
bool DestroyWindows()
Definition: GEM.C:584
unsigned int _id
Definition: GEM.H:284
std::vector< GEM_DomainBoundary > _db
Definition: GEM.H:305
std::ostream * _out
Definition: GEM.H:308
std::string TRAIL_CWD(void)
Definition: Rocin.h:64
bool TRAIL_FluRegisterSurfSoln(GEM_DomainBoundary &db, const std::string &wname, bool all=true)
bool TRAIL_FluWriteNative(GEM_Partition &gp, const std::string &path)
bool TRAIL_RemeshInitFluVolData(GEM_Partition &gp, int src_index=0)
std::vector< unsigned int > _pyrconn
Definition: GEM.H:297
Definition: Rocout.h:81
void test(void)
Definition: flotsam.C:99
std::vector< unsigned int > _hexconn
Definition: GEM.H:301
const NT & n
std::vector< int > _stride_field
Definition: GEM.H:103
void COM_new_window(const char *wname, MPI_Comm c=MPI_COMM_NULL)
Definition: roccom_c++.h:86
void COM_set_profiling(int i)
Definition: roccom_c++.h:550
bool TRAIL_FluPopRemBordIndFILE(GEM_Partition &gp, double t=0.0, bool unsteady=true, const std::string &path="./")
std::string volume_window
Definition: GEM.H:318
int TRAIL_CreateDirectory(const std::string &fname)
GEM_UserData _data
Definition: GEM.H:137
bool WindowInitDone()
Definition: GEM.C:575
bool _debug
Definition: GEM.H:310
void TRAIL_MergeRocinFiles(const std::string &srcname, const std::string &trgname, const std::string &path="./", double t=0, unsigned int np=1, std::ostream *=NULL)
Definition: TRAIL.C:2476
GEM_UserData _solver_data
Definition: GEM.H:307
std::ostream * _out
Definition: GEM.H:140
void TRAIL_RemeshFixRocstarFiles(GEM_Partition &gp, const std::string &path, double t)
static int rank
Definition: advectest.C:66
std::vector< double > _nc
Definition: GEM.H:293
std::vector< unsigned int > _prisconn
Definition: GEM.H:299
bool TRAIL_FluRegisterVolSoln(GEM_Partition &gp, bool all=true)
bool TRAIL_RemeshInitFluSurfData(GEM_Partition &gp)
bool TRAIL_ISLINK(const std::string &fname)
void TRAIL_FluCopyCaseFiles(GEM_Partition &gp, const std::string &path)
void TRAIL_RemeshShuffle(const std::string &solver, double t=0, bool debug=false)
std::string surface_window
Definition: GEM.H:319
bool TRAIL_RemeshAutoSurfer(GEM_Partition &gp, const std::string &src, const std::string &srcpath, const std::string &trgpath, const std::string &destpath, double t, MPI_Comm comm)
void TRAIL_RemeshRunDirSetup(const std::string &path, double t, MPI_Comm comm, bool shuffle=false)
#define COM_EXTERN_MODULE(moduleName)
Definition: roccom_basic.h:116
std::string ResolveLink(const std::string &path)