38 #include "../Rocsurf/test/IM_Reader.h"
59 cout <<
"Usage: " << argv[0] <<
" <surffile> <controlfile>" << std::endl;
67 steps(0), interval(0), remesh_interval(0) {}
104 is.get( buf, 255,
':');
105 if ( buf[0] ==
'\0') { is.getline( buf, 255);
continue; }
107 istringstream istr(buf);
108 string keyword; istr >> keyword;
109 is.getline( buf, 255,
':');
111 if ( keyword ==
"method")
113 else if ( keyword ==
"wavefrontal")
115 else if ( keyword ==
"normaldif")
117 else if ( keyword ==
"eigthres")
119 else if ( keyword ==
"courant")
121 else if ( keyword ==
"fangle")
123 else if ( keyword ==
"speed")
125 else if ( keyword ==
"sploc")
127 else if ( keyword ==
"timestep")
129 else if ( keyword ==
"steps")
131 else if ( keyword ==
"interval")
133 else if ( keyword ==
"remesh_interval")
135 else if ( keyword ==
"verbose")
138 std::cerr <<
"Unknow keyword " << keyword << std::endl;
139 is.getline( buf, 255);
142 if (
rank==0) std::cout <<
" speed is " << cp.
speed << std::endl;
148 if ( !cntr_param.
method.empty()) {
151 if (
rank==0) std::cout <<
"Set propagation method to " << cntr_param.
method << std::endl;
156 if (
rank==0) std::cout <<
"Set wavefrontal to " << cntr_param.
wavefrontal << std::endl;
161 if (
rank==0) std::cout <<
"Set normaldif to " << cntr_param.
normaldif << std::endl;
164 if ( !cntr_param.
eigthres.empty()) {
166 if (
rank==0) std::cout <<
"Set eigthres to " << cntr_param.
eigthres << std::endl;
169 if ( !cntr_param.
courant.empty()) {
171 if (
rank==0) std::cout <<
"Set courant constant to " << cntr_param.
courant << std::endl;
174 if ( !cntr_param.
fangle.empty()) {
176 if (
rank==0) std::cout <<
"Set feature angle to " << cntr_param.
fangle << std::endl;
179 if ( !cntr_param.
verbose.empty()) {
182 if (
rank==0) std::cout <<
"Set verbose level to " << cntr_param.
verbose << std::endl;
189 if (
rank==0) cout <<
"Reading surface mesh file \"" << fname <<
'"' << endl;
191 std::string fname_str(fname);
193 std::string::size_type pos = fname_str.find_first_of(
".");
194 const string wname = fname_str.substr( 0, pos);
196 if (
rank==0) cout <<
"Creating window \"" << wname <<
'"' << endl;
199 int npanes = im_reader.
read_winmesh( fname, wname,
false);
227 const char *timelevel,
const char *attr=NULL) {
239 std::string fname = material;
240 if ( attr) fname = fname +
"-"+attr;
241 fname = fname +
"_"+timelevel;
244 else fname.append(
"_");
247 &hdl, (
char*)material.c_str(), timelevel);
270 int *pane_ids, npanes;
273 for (
int i=0;
i<npanes; ++
i) {
274 int pid = pane_ids[
i];
275 MAP::Vector_3<double> *nrms, *centers;
276 COM_get_array( (wname+
".facenormals").c_str(), pid, (
void**)&nrms);
277 COM_get_array( (wname+
".facecenters").c_str(), pid, (
void**)¢ers);
282 pid, (
void**)&cnstr_types);
285 COM_get_size( (wname+
".facenormals").c_str(), pid, &nelems);
289 for (
int j=0;
j<nelems; ++
j) {
291 cnstr_types[
j] =
't';
293 (centers[j][1]>-20.054 || centers[j][1] < -20.5538))
294 cnstr_types[
j] =
't';
295 else if (
square(centers[j][0])+
square(centers[j][2])>=3.9)
305 void remesh(
const string &wname_old,
const string &wname,
307 double len,
bool preserve_feature) {
311 static PROP::Remesher_Simmetrix *rem=NULL;
313 rem =
new PROP::Remesher_Simmetrix();
322 double fangle = (preserve_feature&&!cntr_param.
fangle.empty())
338 int main(
int argc,
char *argv[]) {
366 if (
rank==0) cout <<
"Propagating interface..." << endl;
382 std::sprintf(fname,
"timedata_%03d.txt",
rank);
384 std::string wname_rem = wname;
385 for (
int i=1;
i<=cntr_param.
steps; ++
i) {
386 if (
rank==0) cout <<
"Step " <<
i << endl;
388 for (
int j=0;
j<2;++
j) {
392 std::string wname_old = wname_rem;
394 std::sprintf(buf,
"%s%d", wname.c_str(),
i);
397 remesh( wname_old, wname_rem, cntr_param, len,
j==0);
406 if ( cntr_param.
steps>=1.e6)
407 std::sprintf( steps,
"%07d",
i);
408 else if ( cntr_param.
steps>=1.e5)
409 std::sprintf( steps,
"%06d",
i);
411 std::sprintf( steps,
"%05d",
i);
418 &cntr_param.
timestep, &disps, &code);
432 if ( cntr_param.
steps>=1.e6)
433 std::sprintf( steps,
"%07d",
i);
434 else if ( cntr_param.
steps>=1.e5)
435 std::sprintf( steps,
"%06d",
i);
437 std::sprintf( steps,
"%05d",
i);
int COMMPI_Comm_rank(MPI_Comm c)
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
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 code(though may enhance!portability between Crays and other systems)!INTEGER MPI_TAG_UB
void COM_delete_window(const char *wname)
#define COM_assertion_msg(EX, msg)
This file contains the prototypes for Roccom API.
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 init_parameters(const Control_parameter &cntr_param)
float atof(const char *const str)
Read a float number from a C-string.
std::string read_in_mesh(const char *fname)
void COM_print_profile(const char *fname, const char *header)
void COM_set_profiling_barrier(int hdl, MPI_Comm comm)
void COM_window_init_done(const char *w_str, int pane_changed=true)
This file contains a set of routines for error assertion.
void COM_get_size(const char *wa_str, int pane_id, int *size, int *ng=0)
Get the sizes of an attribute.
void print_usage(int argc, char *argv[])
void COM_new_window(const char *wname, MPI_Comm c=MPI_COMM_NULL)
void COM_set_profiling(int i)
void COM_call_function(const int wf, int argc,...)
void remesh(const string &wname_old, const string &wname, const Control_parameter &cntr_param, double len, bool preserve_feature)
int main(int argc, char *argv[])
void COM_init(int *argc, char ***argv)
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)
void init_constraints_starslice(const string &wname, const Control_parameter &cntr_param)
int read_winmesh(const char *fname, const std::string &wname, bool del=true)
double output_solution(const string &wname, const char *timelevel, double ref=0.)
void init_attributes(const string &wname, const Control_parameter &cntr_param)
#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)
void read_control_file(const char *fname, Control_parameter &cp)
#define COM_EXTERN_MODULE(moduleName)