72 std::cout <<
"Reading file " << fname <<
"..." << std::endl;
83 std::string bufwin(
"bufwin");
95 int npanes, *pane_ids;
99 for (
int i=0;
i<npanes; ++
i) {
105 vector<int>::iterator bcfi = bcflags.begin();
106 while(bcfi != bcflags.end() && delite)
120 std::cout <<
"Applying total displacements..." << std::endl;
143 std::cout <<
"Obtained window " << wname
144 <<
" from file " << fname << std::endl;
149 (bufwin+
".all").c_str(), (with_ghost ? 1 : 0));
152 (bufwin+
".mesh").c_str(), (with_ghost ? 1 : 0));
168 std::string srcfile(src +
"_in_" + timestring +
".txt");
173 MPI_Comm_rank(comm,&rank);
174 std::string srcwin(src+
"_coup");
176 vector<int> bcflags(2);
179 const char *format =
"HDF";
185 read_file(trgfile,trgwin,bcflags,MPI_COMM_NULL,
false,
false,
false);
186 read_file(srcfile,srcwin,bcflags,MPI_COMM_NULL,
false,
false,
false);
196 *gp.
_out <<
"TRAIL_AutoSurfer: Creating overlay for coupled surfaces."
200 *gp.
_out <<
"TRAIL_AutoSurfer: Writing overlay for coupled surfaces."
203 srcwin.c_str(), trgwin.c_str(), format);
215 string r_trgwin(
"new_surf_b");
216 read_file(trgfile,trgwin,bcflags,comm,
false,
true,
false);
217 read_file(srcfile,srcwin,bcflags,comm,
false,
true,
false);
218 read_file(trgfile,r_trgwin,bcflags,comm,
false,
true,
true);
222 std::vector<int> pane_id;
225 *gp.
_out <<
"TRAIL_AutoSurfer: Reading mesh overlay for coupled surfaces."
228 srcwin.c_str(),trgwin.c_str(),format);
237 istringstream Istr(names);
238 for(
int i = 0;
i < num_attributes;
i++){
242 if((loc ==
'e' || loc ==
'n') && comtype ==
COM_DOUBLE){
244 cout <<
"Transferring attribute: " << aname <<
" on "
245 << (loc ==
'e' ?
"elements" :
"nodes") <<
"." << endl;
259 pane_id.resize(npanes);
260 for(
int i = 0;
i < npanes;
i++)
261 pane_id[
i] = srcpane_ids[
i];
265 for(
int p = 0;p < npanes;p++){
266 void *src_ptr = NULL;
269 void *trg_ptr = NULL;
273 &src_ptr,&src_std,&src_cap);
275 &trg_ptr,&trg_std,&trg_cap);
276 if(src_ptr && trg_ptr && (trg_std*trg_cap == src_std*src_cap))
277 memcpy(trg_ptr,src_ptr,
sizeof(
double)*src_std*src_cap);
280 *gp.
_out <<
"TRAIL_AutoSurfer: WARNING: non matching sizes for "
281 << aname <<
" on pane " << pane_id[p] <<
"."
290 std::string rankstr(
"0");
292 std::ostringstream Ostr;
293 Ostr << r_trgwin <<
"_" << timestring <<
"_" << setw(5)
294 << setfill(
'0') << rank+1;
298 r_trgwin.c_str(),timestring.c_str());
300 string controlfilename(Ostr.str() +
"_in.txt");
301 Ouf.open(controlfilename.c_str());
302 Ouf <<
"@Proc: " << rank << endl
303 <<
"@Files: " << Ostr.str() <<
".hdf" << std::endl;
306 std::vector<int>::iterator pii = pane_id.begin();
307 while(pii != pane_id.end())
308 Ouf << *pii++ <<
" ";
317 Ostr << r_trgwin <<
"_" << timestring <<
"_";
323 Ofn << Ostr.str() << setw(5) << setfill(
'0')
325 string filename(Ofn.str() +
"_in.txt");
326 Inf.open(filename.c_str());
328 OutS << Inf.rdbuf() << endl;
330 unlink(filename.c_str());
334 Ouf2.open((r_trgwin+
"_in_"+timestring+
".txt").c_str());
int COM_Type
Indices for derived data types.
void COM_delete_window(const char *wname)
void COM_get_attribute(const std::string wa_str, char *loc, int *type, int *ncomp, std::string *unit)
void read_file(const char *fname, const string &wname, double alpha)
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)
void COM_get_array(const char *wa_str, int pane_id, void **addr, int *strd, int *cap)
Get the address for an attribute on a specific pane.
int COM_get_attribute_handle(const char *waname)
void COM_delete_attribute(const char *wa_str)
Delete an existing attribute.
std::string TRAIL_TimeString(double t)
#define COM_UNLOAD_MODULE_STATIC_DYNAMIC(moduleName, windowString)
void COM_get_attributes(const char *wname, int *na, std::string &names)
void COM_clone_attribute(const char *wname, const char *attr, int wg=1, const char *ptnname=0, int val=0)
Clone the subset of panes of another window of which the given pane attribute has value val...
void COM_new_window(const char *wname, MPI_Comm c=MPI_COMM_NULL)
void COM_call_function(const int wf, int argc,...)
void COM_delete_pane(const char *str, int pid)
void COM_new_attribute(const char *wa_str, const char loc, const int type, int ncomp, const char *unit)
Registering an attribute type.
void COM_get_panes(const char *wname, std::vector< int > &pane_ids, int rank=-2)
void COM_free_buffer(int **buf)
std::string surface_window
#define COM_LOAD_MODULE_STATIC_DYNAMIC(moduleName, windowString)
void COM_resize_array(const char *wa_str, int pane_id=0, void **addr=NULL, int strd=-1, int cap=0)
Resize an attribute on a specific pane and return the address by setting addr.
int COM_get_function_handle(const char *wfname)
#define COM_EXTERN_MODULE(moduleName)