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

#include <Agent.h>

Inheritance diagram for Agent:
Collaboration diagram for Agent:

Public Member Functions

 Agent (Coupling *cp, std::string mod, std::string obj, const char *agent_name, MPI_Comm com, bool wgm=false, bool skipio=false)
 
virtual ~Agent ()
 
virtual void load_module ()
 
virtual void unload_module ()
 
virtual void init_module (double t, double dt)
 
void init_subscheduler (double t)
 
void callMethod (Scheduler_voidfn1_t fn, double t)
 
void schedule ()
 
virtual void finalize ()
 
virtual void input (double t)=0
 
virtual void output_restart_files (double t)=0
 
virtual void output_visualization_files (double t)=0
 
double max_timestep (double t, double dt)
 
Actionget_main_action ()
 
void register_new_attribute (std::string target_window_, std::string attr_, char loc_, int type_, int ncomp_, const char *unit_)
 
void register_clone_attribute (int cond, std::string target_window_, std::string attr_, std::string parent_window_, std::string parent_attr_, int wg_=1, const char *ptnname_=0, int val_=0)
 
void register_use_attribute (std::string target_window_, std::string attr_, std::string parent_window_, std::string parent_attr_, int wg_=1, const char *ptnname_=0, int val_=0)
 
void create_registered_attributes (std::string tmpBuf)
 
void create_registered_window_attributes (std::string target_window)
 
virtual void create_buffer_all ()
 
void assign_attributes ()
 
virtual void read_restart_data ()
 
void add_data ()
 
void add_icaction (Action *act)
 
void add_bcaction (Action *act, int l=1)
 
void add_bcinitaction (Action *act)
 
void add_gmaction (Action *act)
 
void init_callback (const char *surf_win, const char *vol_win, void *option=NULL)
 
void init_bcactions (double t)
 
void obtain_bc (double *a, int *l=NULL)
 
void init_gmactions (double t)
 
void obtain_gm (double *da)
 
void init_bcinitaction (double t)
 
void run_bcinitaction (double t, double dt)
 
Couplingget_coupling ()
 
void register_interpolate (InterpolateBase *ip)
 
std::string get_surface_window () const
 
std::string get_volume_window () const
 
MPI_Comm get_communicator () const
 
std::string get_rocmod_name () const
 
std::string get_modinstance_name () const
 
std::string get_agent_name () const
 
int get_comm_rank () const
 
double get_old_dt () const
 
virtual void init_convergence (int iPredCorr)
 
virtual int check_convergence (double tolerMass, double tolerTract, double tolerVelo)
 
virtual int compute_integrals ()
 
double * get_integrals ()
 
void print (FILE *f)
 
void get_time_string (double t, std::string &s)
 

Protected Types

typedef vector< InterpolateBase * > InterpolateList
 
typedef vector< AttributeBase * > AttributeList
 

Protected Member Functions

Schedulerget_bcScheduler (unsigned int level)
 
void init_function_handles ()
 
void create_window (const char *window_name)
 
void split_surface_window (const std::string surfAll, const std::string surf_i, const std::string surf_nb, const std::string surf_b, const std::string surf_ni)
 
int read_by_control_file (double t, const std::string base, const std::string window)
 
void write_data_files (double t, const std::string base, const std::string attr, const char *ref=NULL)
 
void write_control_file (double t, const std::string base, const std::string window)
 
virtual void store_solutions (int converged)
 
int check_convergence_help (int vcur, int vpre, double tol, std::string str)
 

Protected Attributes

const std::string agent_name
 
MPI_Comm communicator
 
Couplingcoupling
 
PhysicsAction action
 
SchdulerList bcScheduler
 
UserScheduler bcInitScheduler
 
UserScheduler gmScheduler
 
UserScheduler icScheduler
 
int comm_rank
 
int init_handle
 
int update_handle
 
int pre_hdf_handle
 
int post_hdf_handle
 
int finalize_handle
 
int compute_integrals_handle
 
int ic_handle
 
int bc_handle
 
int gm_handle
 
bool withgm
 
int dobackup
 
string rocmod_name
 
string mod_instance
 
string inDir
 
string outDir
 
string suffix
 
double initial_time
 
double timestamp
 
double current_time
 
double current_deltatime
 
double old_dt
 
std::string surf_window
 
std::string vol_window
 
std::string tmp_window
 
void * option_data
 
InterpolateList interpolateList
 
AttributeList attributeList
 
int pc_hdls [2][3]
 
int pc_count
 
double integrals [MAN_INTEG_SIZE]
 
bool skipInputIO
 

Static Protected Attributes

static int read_by_control_handle =0
 
static int read_files_handle =0
 
static int obtain_attr_handle =0
 
static int write_attr_handle =0
 
static int write_ctrl_handle =0
 

Friends

class PhysicsAction
 

Detailed Description

Definition at line 110 of file Agent.h.

Member Typedef Documentation

typedef vector< AttributeBase* > AttributeList
protected

Definition at line 155 of file Agent.h.

typedef vector< InterpolateBase* > InterpolateList
protected

Definition at line 152 of file Agent.h.

Constructor & Destructor Documentation

Agent ( Coupling cp,
std::string  mod,
std::string  obj,
const char *  agent_name,
MPI_Comm  com,
bool  wgm = false,
bool  skipio = false 
)

Definition at line 201 of file Agent.C.

References action, agent_name, bcInitScheduler, comm_rank, create_window(), Control_parameters::current_time, dobackup, get_agent_name(), Coupling::get_control_param(), gmScheduler, inDir, MAN_DEBUG, old_dt, outDir, Scheduler::set_name(), Action::set_name(), suffix, and timestamp.

203  : agent_name(agentname), communicator(com), coupling(cp), action(this),
204  withgm(wgm), rocmod_name( mod), mod_instance(obj), skipInputIO(skipio)
205 {
206  MPI_Comm_rank( com, &comm_rank);
207 
208  if(comm_rank == 0)
209  MAN_DEBUG(3, ("Rocstar: Agent::Agent create window %s.\n", get_agent_name().c_str()));
210  create_window(agent_name.c_str());
211 
212  inDir = obj; inDir.append("/Rocin/");
213  outDir = obj; outDir.append("/Rocout/");
214  suffix = ".hdf";
215 
216  // set proper names for visu
217  std::string physicsname = agentname;
218  physicsname = physicsname+"-PhysicsAction";
219  action.set_name(physicsname.c_str());
220 
221  bcInitScheduler.set_name("bcInitSched");
222  gmScheduler.set_name("gmSched");
223 
225  old_dt = 0.0;
226  dobackup = 1;
227 }
string outDir
Definition: Agent.h:142
string rocmod_name
Definition: Agent.h:141
void set_name(const char *name)
Definition: Scheduler.h:50
T mod(const T &x, const T &m)
Return the modulo of a number.
Definition: CImg.h:4788
std::string get_agent_name() const
Definition: Agent.h:223
Coupling * coupling
Definition: Agent.h:115
const std::string agent_name
Definition: Agent.h:113
string inDir
Definition: Agent.h:142
void create_window(const char *window_name)
Definition: Agent.C:281
UserScheduler gmScheduler
Definition: Agent.h:119
MPI_Comm communicator
Definition: Agent.h:114
int dobackup
Definition: Agent.h:139
void set_name(const char *name)
Definition: Action.h:54
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
double current_time
Definition: Coupling.h:54
string suffix
Definition: Agent.h:142
UserScheduler bcInitScheduler
Definition: Agent.h:118
PhysicsAction action
Definition: Agent.h:116
bool skipInputIO
Definition: Agent.h:164
string mod_instance
Definition: Agent.h:141
const Control_parameters * get_control_param()
Definition: Coupling.h:183
double timestamp
Definition: Agent.h:144
double old_dt
Definition: Agent.h:144
int comm_rank
Definition: Agent.h:130
bool withgm
Definition: Agent.h:137

Here is the call graph for this function:

~Agent ( )
virtual

Definition at line 229 of file Agent.C.

230 {
231 }

Member Function Documentation

void add_bcaction ( Action act,
int  l = 1 
)

Definition at line 393 of file Agent.C.

References UserScheduler::add_action(), bcScheduler, COM_assertion_msg, and Scheduler::set_name().

Referenced by declare_fluid_actions(), declare_solid_actions(), and FluidBurnAlone::FluidBurnAlone().

394 {
395  int cur = bcScheduler.size();
396  COM_assertion_msg(l>=1 && l <= cur+1, "ERROR: add_bcaction.\n");
397  UserScheduler *sched;
398  if (cur == l-1) {
399  sched = new UserScheduler;
400  char str[128];
401  sprintf(str, "%s%d", "bcSched", l);
402  sched->set_name(str);
403  bcScheduler.push_back(sched);
404  }
405  else
406  sched = bcScheduler[l-1];
407  COM_assertion_msg(sched, "ERROR: add_bcaction with no scheduler.\n");
408  sched->add_action(act);
409 }
SchdulerList bcScheduler
Definition: Agent.h:117
void set_name(const char *name)
Definition: Scheduler.h:50
#define COM_assertion_msg(EX, msg)
virtual void add_action(Action *)
Definition: Scheduler.C:401

Here is the call graph for this function:

Here is the caller graph for this function:

void add_bcinitaction ( Action act)

Definition at line 387 of file Agent.C.

References UserScheduler::add_action(), and bcInitScheduler.

Referenced by declare_solid_actions(), and FluidBurnAlone::FluidBurnAlone().

388 {
390 }
virtual void add_action(Action *)
Definition: Scheduler.C:401
UserScheduler bcInitScheduler
Definition: Agent.h:118

Here is the call graph for this function:

Here is the caller graph for this function:

void add_data ( )
inline

Definition at line 195 of file Agent.h.

195 { /* TODO */ }
void add_gmaction ( Action act)

Definition at line 411 of file Agent.C.

References UserScheduler::add_action(), and gmScheduler.

Referenced by declare_fluid_actions(), and FluidBurnAlone::FluidBurnAlone().

412 {
413  gmScheduler.add_action(act);
414 }
virtual void add_action(Action *)
Definition: Scheduler.C:401
UserScheduler gmScheduler
Definition: Agent.h:119

Here is the call graph for this function:

Here is the caller graph for this function:

void add_icaction ( Action act)

Definition at line 381 of file Agent.C.

References UserScheduler::add_action(), and icScheduler.

Referenced by declare_fluid_actions(), declare_solid_actions(), and FluidBurnAlone::FluidBurnAlone().

382 {
383  icScheduler.add_action(act);
384 }
virtual void add_action(Action *)
Definition: Scheduler.C:401
UserScheduler icScheduler
Definition: Agent.h:120

Here is the call graph for this function:

Here is the caller graph for this function:

void assign_attributes ( )

Definition at line 373 of file Agent.C.

References attributeList, i, n, and tmp_window.

374 {
375  unsigned int n = attributeList.size();
376  for (unsigned int i=0; i<n; i++) {
377  attributeList[i]->assign(tmp_window);
378  }
379 }
blockLoc i
Definition: read.cpp:79
std::string tmp_window
Definition: Agent.h:149
const NT & n
AttributeList attributeList
Definition: Agent.h:156
void callMethod ( Scheduler_voidfn1_t  fn,
double  t 
)

Definition at line 434 of file Agent.C.

References bcInitScheduler, bcScheduler, gmScheduler, and i.

Referenced by init_subscheduler().

435 {
436  unsigned int i;
437 
438  (bcInitScheduler.*fn)( t);
439  for (i=0; i<bcScheduler.size(); i++) {
440  (bcScheduler[i]->*fn)( t);
441  }
442  (gmScheduler.*fn)( t);
443 }
SchdulerList bcScheduler
Definition: Agent.h:117
blockLoc i
Definition: read.cpp:79
UserScheduler gmScheduler
Definition: Agent.h:119
UserScheduler bcInitScheduler
Definition: Agent.h:118

Here is the caller graph for this function:

virtual int check_convergence ( double  tolerMass,
double  tolerTract,
double  tolerVelo 
)
inlinevirtual

Reimplemented in FluidAgent.

Definition at line 229 of file Agent.h.

229 { return 1; }
int check_convergence_help ( int  vcur,
int  vpre,
double  tol,
std::string  str 
)
protected

Definition at line 743 of file Agent.C.

References COM_call_function(), comm_rank, communicator, man_verbose, RocBlas::nrm2_scalar_MPI, and RocBlas::sub.

Referenced by FluidAgent::check_convergence().

744 {
745  double nrm_val=0.0, nrm_diff=0.0, ratio;
746 
747  COM_call_function( RocBlas::sub, &vcur, &vpre, &vpre);
750 
751  if (nrm_val != 0.)
752  ratio = nrm_diff/nrm_val;
753  else
754  ratio = nrm_diff;
755  int result = (ratio <= tol);
756 
757  if (comm_rank==0 && man_verbose > 1)
758  std::cout << " Convergence ratio of " << str << " is " << ratio << std::endl;
759  return result;
760 }
static int nrm2_scalar_MPI
Definition: RocBlas.h:51
int man_verbose
MPI_Comm communicator
Definition: Agent.h:114
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
static int sub
Definition: RocBlas.h:36
int comm_rank
Definition: Agent.h:130

Here is the call graph for this function:

Here is the caller graph for this function:

virtual int compute_integrals ( )
inlinevirtual

Reimplemented in SolidAgent, and FluidAgent.

Definition at line 231 of file Agent.h.

231 { return 0; }
void create_buffer_all ( )
virtual

Reimplemented in SolidAgent, BurnAgent, and FluidAgent.

Definition at line 361 of file Agent.C.

References COM_new_window(), COM_use_attribute(), COM_window_init_done(), create_registered_window_attributes(), get_agent_name(), MAN_DEBUG, surf_window, and tmp_window.

Referenced by BurnAgent::create_buffer_all(), FluidAgent::create_buffer_all(), SolidAgent::create_buffer_all(), and init_callback().

362 {
363  MAN_DEBUG(3, ("Rocstar: Agent %s::create_buffer_all called %s.\n", get_agent_name().c_str(), tmp_window.c_str()));
365 // COM_use_attribute( tmp_window, surf_window+".all", 1);
368  //create_registered_attributes(tmp_window);
371 }
std::string get_agent_name() const
Definition: Agent.h:223
void COM_use_attribute(const char *wname, const char *attr, int wg=1, const char *ptnname=0, int val=0)
Use the subset of panes of another window of which the given pane attribute has value val...
Definition: roccom_c++.h:224
std::string surf_window
Definition: Agent.h:148
std::string tmp_window
Definition: Agent.h:149
void COM_window_init_done(const char *w_str, int pane_changed=true)
Definition: roccom_c++.h:102
void COM_new_window(const char *wname, MPI_Comm c=MPI_COMM_NULL)
Definition: roccom_c++.h:86
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
void create_registered_window_attributes(std::string target_window)
Definition: Agent.C:350

Here is the call graph for this function:

Here is the caller graph for this function:

void create_registered_attributes ( std::string  tmpBuf)

Definition at line 340 of file Agent.C.

References attributeList, COM_window_init_done(), comm_rank, i, MAN_DEBUG, and n.

341 {
342  unsigned int n = attributeList.size();
343  for (unsigned int i=0; i<n; i++) {
344  MAN_DEBUG(3, ("[%d] creating %s %s\n", comm_rank, attributeList[i]->target_window.c_str(), attributeList[i]->attr.c_str()));
345  attributeList[i]->create(attributeList[i]->target_window);
346  }
347  COM_window_init_done( tmpBuf);
348 }
blockLoc i
Definition: read.cpp:79
void COM_window_init_done(const char *w_str, int pane_changed=true)
Definition: roccom_c++.h:102
const NT & n
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
int comm_rank
Definition: Agent.h:130
AttributeList attributeList
Definition: Agent.h:156

Here is the call graph for this function:

void create_registered_window_attributes ( std::string  target_window)

Definition at line 350 of file Agent.C.

References attributeList, comm_rank, i, MAN_DEBUG, and n.

Referenced by BurnAgent::create_buffer_all(), FluidAgent::create_buffer_all(), SolidAgent::create_buffer_all(), and create_buffer_all().

351 {
352  unsigned int n = attributeList.size();
353  for (unsigned int i=0; i<n; i++) {
354  if (attributeList[i]->target_window == target_window) {
355  MAN_DEBUG(3, ("[%d] creating %s %s\n", comm_rank, attributeList[i]->target_window.c_str(), attributeList[i]->attr.c_str()));
356  attributeList[i]->create(attributeList[i]->target_window);
357  }
358  }
359 }
blockLoc i
Definition: read.cpp:79
const NT & n
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
int comm_rank
Definition: Agent.h:130
AttributeList attributeList
Definition: Agent.h:156

Here is the caller graph for this function:

void create_window ( const char *  window_name)
protected

Definition at line 281 of file Agent.C.

References bc_handle, COM_DOUBLE, COM_get_function_handle(), COM_INT, COM_new_attribute(), COM_new_window(), COM_RAWDATA, COM_set_member_function(), COM_set_object(), COM_STRING, COM_VOID, COM_window_init_done(), gm_handle, ic_handle, init_callback(), obtain_bc(), and obtain_gm().

Referenced by Agent().

282 {
283  // create window and global variables
284  char global[128];
285  COM_new_window(window_name);
286  sprintf(global, "%s%s", window_name, ".global");
287  COM_new_attribute(global, 'w', COM_VOID, 1, "");
288  COM_set_object(global, 0, this);
289 
290  //
291  COM_Type types[4];
292  types[0] = COM_RAWDATA;
293 
294  char window_func[128];
295 
296  sprintf(window_func, "%s.init_callback", window_name);
297  types[1] = COM_STRING;
298  types[2] = COM_STRING;
299  types[3] = COM_VOID;
300  COM_set_member_function(window_func, (Member_func_ptr)&Agent::init_callback,
301  global, "biiI", types);
302  ic_handle = COM_get_function_handle(window_func);
303 
304  types[1] = COM_DOUBLE;
305  types[2] = COM_INT;
306  sprintf(window_func, "%s.obtain_bc", window_name);
307  COM_set_member_function(window_func, (Member_func_ptr)&Agent::obtain_bc, global, "biI", types);
308  bc_handle = COM_get_function_handle(window_func);
309 
310  sprintf(window_func, "%s.obtain_gm", window_name);
311  COM_set_member_function(window_func, (Member_func_ptr)&Agent::obtain_gm, global, "bi", types);
312  gm_handle = COM_get_function_handle(window_func);
313 
314  COM_window_init_done(window_name);
315 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
int ic_handle
Definition: Agent.h:136
int bc_handle
Definition: Agent.h:136
int gm_handle
Definition: Agent.h:136
void COM_set_object(const char *wa_str, int pane_id, Type *addr)
Definition: roccom_c++.h:144
void obtain_bc(double *a, int *l=NULL)
Definition: Agent.C:524
void COM_window_init_done(const char *w_str, int pane_changed=true)
Definition: roccom_c++.h:102
void COM_new_window(const char *wname, MPI_Comm c=MPI_COMM_NULL)
Definition: roccom_c++.h:86
void init_callback(const char *surf_win, const char *vol_win, void *option=NULL)
Definition: Agent.C:482
void obtain_gm(double *da)
Definition: Agent.C:543
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
void COM_set_member_function(const char *wf_str, Member_func_ptr func, const char *wa_str, const char *intents, const COM_Type *types)
Definition: roccom_c++.h:330
int COM_get_function_handle(const char *wfname)
Definition: roccom_c++.h:428

Here is the call graph for this function:

Here is the caller graph for this function:

void finalize ( )
virtual

Reimplemented in SolidAgent, BurnAgent, and FluidAgent.

Definition at line 466 of file Agent.C.

References bcInitScheduler, bcScheduler, COM_call_function(), comm_rank, Scheduler::finalize_actions(), finalize_handle, get_agent_name(), get_coupling(), gmScheduler, i, icScheduler, and MAN_DEBUG.

Referenced by BurnAgent::finalize(), FluidAgent::finalize(), and SolidAgent::finalize().

467 {
468  MAN_DEBUG(3, ("[%d] Rocstar: %s::finalize called.\n", comm_rank, get_agent_name().c_str()));
469 
472  for (unsigned int i=0; i<bcScheduler.size(); i++)
473  bcScheduler[i]->finalize_actions();
475 
476  // at restart, we don't want windows in physics modules deleted
477  if (! get_coupling()->in_restart())
479 }
SchdulerList bcScheduler
Definition: Agent.h:117
std::string get_agent_name() const
Definition: Agent.h:223
Coupling * get_coupling()
Definition: Agent.h:213
blockLoc i
Definition: read.cpp:79
UserScheduler gmScheduler
Definition: Agent.h:119
void finalize_actions()
Definition: Scheduler.C:351
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
UserScheduler bcInitScheduler
Definition: Agent.h:118
int finalize_handle
Definition: Agent.h:133
UserScheduler icScheduler
Definition: Agent.h:120
int comm_rank
Definition: Agent.h:130

Here is the call graph for this function:

Here is the caller graph for this function:

Scheduler* get_bcScheduler ( unsigned int  level)
inlineprotected

Definition at line 239 of file Agent.h.

Referenced by obtain_bc().

239 { return level-1<bcScheduler.size()?bcScheduler[level-1]:NULL; }
SchdulerList bcScheduler
Definition: Agent.h:117

Here is the caller graph for this function:

int get_comm_rank ( ) const
inline

Definition at line 224 of file Agent.h.

Referenced by _load_rocface(), compute_overlay(), HeatTransfer_FS::init(), SurfDiver::run(), MassTransfer_SF_ALE::run(), TemperatureTransfer_SF::run(), and HeatTransfer_FS::run().

224 { return comm_rank; }
int comm_rank
Definition: Agent.h:130

Here is the caller graph for this function:

MPI_Comm get_communicator ( ) const
inline
Coupling* get_coupling ( )
inline

Definition at line 213 of file Agent.h.

Referenced by _load_rocface(), ComputeFluidLoad_ALE::ComputeFluidLoad_ALE(), BurnAgent::create_buffer_all(), FluidAgent::create_buffer_all(), SolidAgent::create_buffer_all(), declare_solid_actions(), BurnAgent::finalize(), FluidAgent::finalize(), SolidAgent::finalize(), finalize(), FluidBurnAlone::FluidBurnAlone(), LoadTransfer_FS::init(), LoadTransfer_FSc_ALE::init(), LoadTransferOnly_FSc_ALE::init(), SurfDiver::init(), MeshMotionTransfer_SF::init(), DeformationVelTransfer_SF::init(), MeshMotionTransferISS::init(), TransferSolidDensity::init(), FluidPropagateSurface::init(), TransferBurnRate_FS_ALE::init(), MassTransfer_SF_ALE::init(), TemperatureTransfer_SF::init(), HeatTransfer_FS::init(), RemeshInit::init(), ComputePconn::init(), SolidPropagateSurface_ALE::init(), BurnAgent::init_module(), LoadTransfer_FS::LoadTransfer_FS(), LoadTransfer_FSc_ALE::LoadTransfer_FSc_ALE(), LoadTransferOnly_FSc_ALE::LoadTransferOnly_FSc_ALE(), Extrapolate_Linear::run(), Extrapolate_Central::run(), LoadTransfer_FSc_ALE::run(), Interpolate_Linear::run(), Interpolate_Central::run(), PhysicsAction::run(), GetDeformedMesh_ALE::run(), MeshMotionTransfer_SF::run(), ComputeFluidLoad_ALE::run(), TransferSolidDensity::run(), FluidPropagateSurface::run(), CopyBflagFromBurn::run(), SolidPropagateSurface_ALE::run(), run_bcinitaction(), FluidAgent::unload_module(), BurnAgent::unload_module(), SolidAgent::unload_module(), write_control_file(), and write_data_files().

213 { return coupling; }
Coupling * coupling
Definition: Agent.h:115
double* get_integrals ( )
inline

Definition at line 232 of file Agent.h.

Referenced by FullyCoupling::update_integrals().

232 { return integrals; }
double integrals[MAN_INTEG_SIZE]
Definition: Agent.h:162

Here is the caller graph for this function:

Action* get_main_action ( )
inline

Definition at line 183 of file Agent.h.

Referenced by FluidAlone::FluidAlone(), and FluidBurnAlone::FluidBurnAlone().

183 { return &action; }
PhysicsAction action
Definition: Agent.h:116

Here is the caller graph for this function:

std::string get_modinstance_name ( ) const
inline

Definition at line 222 of file Agent.h.

Referenced by _load_rocface().

222 { return mod_instance; }
string mod_instance
Definition: Agent.h:141

Here is the caller graph for this function:

double get_old_dt ( ) const
inline

Definition at line 226 of file Agent.h.

Referenced by InterpolateBase::backup(), Extrapolate_Linear::run(), Extrapolate_Central::run(), Interpolate_Linear::run(), and Interpolate_Central::run().

226 { return old_dt; }
double old_dt
Definition: Agent.h:144

Here is the caller graph for this function:

std::string get_rocmod_name ( ) const
inline

Definition at line 221 of file Agent.h.

Referenced by compute_overlay(), SurfDiver::init(), SurfDiver::run(), and SurfDiver::SurfDiver().

221 { return rocmod_name; }
string rocmod_name
Definition: Agent.h:141

Here is the caller graph for this function:

void get_time_string ( double  t,
std::string &  s 
)

Definition at line 578 of file Agent.C.

Referenced by compute_overlay(), read_by_control_file(), SurfDiver::run(), write_control_file(), and write_data_files().

578  {
579  char chrstring[15];
580 
581  std::sprintf( chrstring, "%.5e", t*1.e10);
582 
583  s = ""; s.append( &chrstring[9]); s.append( ".");
584  s.append( &chrstring[0], 1); s.append( &chrstring[2], 5);
585 }
double s
Definition: blastest.C:80

Here is the caller graph for this function:

std::string get_volume_window ( ) const
inline

Definition at line 218 of file Agent.h.

218 { return vol_window; }
std::string vol_window
Definition: Agent.h:148
void init_bcactions ( double  t)

Definition at line 445 of file Agent.C.

References bcScheduler, and i.

Referenced by BCInvoker::init().

446 {
447  for (unsigned int i=0; i<bcScheduler.size(); i++)
448  bcScheduler[i]->init_actions(t);
449 }
SchdulerList bcScheduler
Definition: Agent.h:117
blockLoc i
Definition: read.cpp:79

Here is the caller graph for this function:

void init_bcinitaction ( double  t)

Definition at line 557 of file Agent.C.

References bcInitScheduler, and Scheduler::init_actions().

Referenced by BCInitInvoker::init().

558 {
560 }
UserScheduler bcInitScheduler
Definition: Agent.h:118
void init_actions(double t)
Definition: Scheduler.C:324

Here is the call graph for this function:

Here is the caller graph for this function:

void init_callback ( const char *  surf_win,
const char *  vol_win,
void *  option = NULL 
)

Definition at line 482 of file Agent.C.

References comm_rank, create_buffer_all(), current_deltatime, current_time, get_agent_name(), icScheduler, Scheduler::init_actions(), Scheduler::isEmpty(), MAN_DEBUG, cimg_library::cimg::option(), option_data, rocmod_name, Scheduler::run_actions(), Scheduler::set_alpha(), surf_window, and vol_window.

Referenced by create_window().

484 {
485  MAN_DEBUG(3, ("Rocstar: %s::init_callback called: surfwin: %s volwin: %s.\n", get_agent_name().c_str(), surf_win, vol_win));
486 
487  surf_window = surf_win;
488  vol_window = vol_win;
490 
491  // creat a window buffer to inherit from surface window
492  // they are like ifluid_all, iburn_all, etc
494 
495  if (icScheduler.isEmpty()) {
496  if (comm_rank==0)
497  std::cerr << "Rocstar: Warning: No actions defined for "
498  << "Initialization callback for module "
499  << rocmod_name << std::endl;
500  }
501  else {
502  MAN_DEBUG(3, ("[%d] Rocstar: %s::init_callback called IC with current_time:%e current_deltatime:%e.\n", comm_rank, get_agent_name().c_str(), current_time, current_deltatime));
503  icScheduler.set_alpha(0.0);
506  MAN_DEBUG(3, ("[%d] Rocstar: %s::init_callback called IC DONE.\n", comm_rank, get_agent_name().c_str()));
507  }
508 
509  MAN_DEBUG(3, ("Rocstar: Agent::init_callback called: surfwin: %s volwin: %s DONE.\n", surf_win, vol_win));
510 }
double current_deltatime
Definition: Agent.h:144
string rocmod_name
Definition: Agent.h:141
const char * option(const char *const name, const int argc, const char *const *const argv, const char *defaut, const char *const usage=0)
Definition: CImg.h:5604
std::string get_agent_name() const
Definition: Agent.h:223
void set_alpha(double alpha)
Definition: Scheduler.h:44
bool isEmpty()
Definition: Scheduler.h:48
std::string vol_window
Definition: Agent.h:148
virtual void create_buffer_all()
Definition: Agent.C:361
std::string surf_window
Definition: Agent.h:148
double current_time
Definition: Agent.h:144
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
void * option_data
Definition: Agent.h:150
void init_actions(double t)
Definition: Scheduler.C:324
UserScheduler icScheduler
Definition: Agent.h:120
void run_actions(double t, double dt)
Definition: Scheduler.C:339
int comm_rank
Definition: Agent.h:130

Here is the call graph for this function:

Here is the caller graph for this function:

void init_convergence ( int  iPredCorr)
virtual

Reimplemented in FluidAgent.

Definition at line 720 of file Agent.C.

References store_solutions().

Referenced by FluidAgent::init_convergence().

721 {
722  store_solutions (iPredCorr == 1);
723 }
virtual void store_solutions(int converged)
Definition: Agent.C:725

Here is the call graph for this function:

Here is the caller graph for this function:

void init_function_handles ( )
protected

Definition at line 234 of file Agent.C.

References COM_assertion_msg, COM_get_function_handle(), COM_set_profiling_barrier(), communicator, compute_integrals_handle, finalize_handle, init_handle, mod_instance, obtain_attr_handle, post_hdf_handle, pre_hdf_handle, read_by_control_handle, read_files_handle, update_handle, write_attr_handle, and write_ctrl_handle.

Referenced by BurnAgent::load_module(), FluidAgent::load_module(), and SolidAgent::load_module().

235 {
236  // init function handle
237  char fname[128];
238  sprintf(fname, "%s%s", mod_instance.c_str(), ".initialize");
240  COM_assertion_msg(init_handle>0, "ERROR: Agent::init_function_handles.\n");
241 
242  sprintf(fname, "%s%s", mod_instance.c_str(), ".update_solution");
244  COM_assertion_msg(update_handle>0, "ERROR: Agent::init_function_handles.\n");
245 
246  sprintf(fname, "%s%s", mod_instance.c_str(), ".finalize");
248  COM_assertion_msg(finalize_handle>0, "ERROR: Agent::init_function_handles.\n");
249 
250  // optional
251  sprintf(fname, "%s%s", mod_instance.c_str(), ".pre_hdf_output");
253 
254  // optional
255  sprintf(fname, "%s%s", mod_instance.c_str(), ".post_hdf_output");
257 
259  COM_set_profiling_barrier( update_handle, communicator);
260  COM_set_profiling_barrier( finalize_handle, communicator);
261  if (pre_hdf_handle != -1)
262  COM_set_profiling_barrier( pre_hdf_handle, communicator);
263  if (post_hdf_handle != -1)
264  COM_set_profiling_barrier( post_hdf_handle, communicator);
265 
266  sprintf(fname, "%s%s", mod_instance.c_str(), ".compute_integrals");
268 
269  read_files_handle = COM_get_function_handle( "IN.read_window");
270  read_by_control_handle = COM_get_function_handle( "IN.read_by_control_file");
271  obtain_attr_handle = COM_get_function_handle( "IN.obtain_attribute");
272  write_attr_handle = COM_get_function_handle( "OUT.write_attribute");
273  write_ctrl_handle = COM_get_function_handle( "OUT.write_rocin_control_file");
274 
279 }
#define COM_assertion_msg(EX, msg)
int init_handle
Definition: Agent.h:131
int update_handle
Definition: Agent.h:131
int compute_integrals_handle
Definition: Agent.h:133
int post_hdf_handle
Definition: Agent.h:132
static int write_ctrl_handle
Definition: Agent.h:127
void COM_set_profiling_barrier(int hdl, MPI_Comm comm)
Definition: roccom_c++.h:554
static int write_attr_handle
Definition: Agent.h:126
MPI_Comm communicator
Definition: Agent.h:114
int pre_hdf_handle
Definition: Agent.h:132
static int read_by_control_handle
Definition: Agent.h:123
static int read_files_handle
Definition: Agent.h:124
static int obtain_attr_handle
Definition: Agent.h:125
int finalize_handle
Definition: Agent.h:133
string mod_instance
Definition: Agent.h:141
int COM_get_function_handle(const char *wfname)
Definition: roccom_c++.h:428

Here is the call graph for this function:

Here is the caller graph for this function:

void init_gmactions ( double  t)

Definition at line 451 of file Agent.C.

References gmScheduler, and Scheduler::init_actions().

Referenced by GMInvoker::init().

452 {
454 }
UserScheduler gmScheduler
Definition: Agent.h:119
void init_actions(double t)
Definition: Scheduler.C:324

Here is the call graph for this function:

Here is the caller graph for this function:

void init_module ( double  t,
double  dt 
)
virtual

Reimplemented in SolidAgent, BurnAgent, and FluidAgent.

Definition at line 416 of file Agent.C.

References comm_rank, current_deltatime, current_time, get_agent_name(), initial_time, MAN_DEBUG, and old_dt.

Referenced by BurnAgent::init_module(), FluidAgent::init_module(), and SolidAgent::init_module().

417 {
418  MAN_DEBUG(3, ("[%d] Rocstar: %s::init_module with current_time:%e current_deltatime:%e.\n", comm_rank, get_agent_name().c_str(), t, dt));
419 
421  current_deltatime = dt;
422  old_dt = 0.0;
423 }
double current_deltatime
Definition: Agent.h:144
std::string get_agent_name() const
Definition: Agent.h:223
double initial_time
Definition: Agent.h:144
double current_time
Definition: Agent.h:144
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
double old_dt
Definition: Agent.h:144
int comm_rank
Definition: Agent.h:130

Here is the call graph for this function:

Here is the caller graph for this function:

void init_subscheduler ( double  t)

Definition at line 425 of file Agent.C.

References callMethod(), get_agent_name(), Scheduler::init_actions(), and MAN_DEBUG.

426 {
427  MAN_DEBUG(3, ("Rocstar: %sAgent::init_subscheduler called.\n", get_agent_name().c_str()));
428 
430 
431  MAN_DEBUG(3, ("Rocstar: %sAgent::init_subscheduler done.\n", get_agent_name().c_str()));
432 }
std::string get_agent_name() const
Definition: Agent.h:223
void callMethod(Scheduler_voidfn1_t fn, double t)
Definition: Agent.C:434
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
void init_actions(double t)
Definition: Scheduler.C:324

Here is the call graph for this function:

virtual void input ( double  t)
pure virtual

Implemented in SolidAgent, BurnAgent, and FluidAgent.

virtual void load_module ( )
inlinevirtual

Reimplemented in SolidAgent, BurnAgent, and FluidAgent.

Definition at line 169 of file Agent.h.

169 {}
double max_timestep ( double  t,
double  dt 
)

Definition at line 317 of file Agent.C.

Referenced by Coupling::run().

318 {
319  return dt;
320 }

Here is the caller graph for this function:

void obtain_bc ( double *  a,
int *  l = NULL 
)

Definition at line 524 of file Agent.C.

References bcScheduler, comm_rank, current_deltatime, get_agent_name(), get_bcScheduler(), MAN_DEBUG, rocmod_name, Scheduler::run_actions(), Scheduler::set_alpha(), and timestamp.

Referenced by create_window(), and BCInvoker::run().

525 {
526  if ( l!=NULL && (unsigned int)(*l) > bcScheduler.size() && comm_rank==0) {
527  std::cerr << "Rocstar: Warning: No actions defined for "
528  << "level-" << *l << " boundary condition "
529  << "for module " << rocmod_name << std::endl;
530  return;
531  }
532 
533  int level = (l==NULL)?1:*l;
534  MAN_DEBUG(3, ("[%d] Rocstar: Agent %s::obtain_bc called at level: %d t:%e.\n", comm_rank, get_agent_name().c_str(), level, timestamp))
535  Scheduler *sched = get_bcScheduler(level);
536  if (sched) {
537  sched->set_alpha(*a);
538  sched->run_actions(timestamp, current_deltatime);
539  }
540 }
if(dy > dx)
double current_deltatime
Definition: Agent.h:144
string rocmod_name
Definition: Agent.h:141
SchdulerList bcScheduler
Definition: Agent.h:117
Scheduler * get_bcScheduler(unsigned int level)
Definition: Agent.h:239
std::string get_agent_name() const
Definition: Agent.h:223
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
double timestamp
Definition: Agent.h:144
int comm_rank
Definition: Agent.h:130

Here is the call graph for this function:

Here is the caller graph for this function:

void obtain_gm ( double *  da)

Definition at line 543 of file Agent.C.

References comm_rank, current_deltatime, gmScheduler, Scheduler::isEmpty(), MAN_DEBUG, rocmod_name, Scheduler::run_actions(), and Scheduler::set_alpha().

Referenced by create_window(), and GMInvoker::run().

544 {
545  if (gmScheduler.isEmpty() && comm_rank==0) {
546  std::cerr << "Rocstar: Warning: No actions defined for "
547  << "Grid Motion "
548  << "for module " << rocmod_name << std::endl;
549  return;
550  }
551  MAN_DEBUG(3, ("[%d] Rocstar: Agent::obtain_gm called with alpha: %e.\n", comm_rank, *da))
552  // ???????????????
553  gmScheduler.set_alpha(*da);
554  gmScheduler.run_actions(0.0, current_deltatime);
555 }
double current_deltatime
Definition: Agent.h:144
string rocmod_name
Definition: Agent.h:141
bool isEmpty()
Definition: Scheduler.h:48
UserScheduler gmScheduler
Definition: Agent.h:119
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
int comm_rank
Definition: Agent.h:130

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void output_restart_files ( double  t)
pure virtual

Implemented in SolidAgent, BurnAgent, and FluidAgent.

virtual void output_visualization_files ( double  t)
pure virtual

Implemented in SolidAgent, BurnAgent, and FluidAgent.

void print ( FILE *  f)

Definition at line 762 of file Agent.C.

References bcInitScheduler, bcScheduler, get_agent_name(), gmScheduler, i, and Scheduler::print().

Referenced by PhysicsAction::print().

763 {
764  unsigned int i;
765 
766  // agent
767  fprintf(f, "graph: { title: \"%s\" label: \"%s\" \n\
768  status: folded \n\
769  display_edge_labels: yes \n\
770  layoutalgorithm: tree \n\
771  scaling: maxspect \n\
772  color : lightyellow \n\
773  node.color : lightblue \n\
774  node.textcolor : lightblue \n\
775  node.bordercolor: black \n\
776  node.borderwidth: 1 \n\
777  edge.color : lightblue \n\
778  edge.arrowsize : 7 \n\
779  edge.thickness : 2 \n\
780  edge.fontname:\"helvO08\" \n\
781  node.label: \"no type\" \n", get_agent_name().c_str(), get_agent_name().c_str());
782 
783  char *bcinit = bcInitScheduler.print(f, get_agent_name().c_str());
784 
785  // main physics
786  std::string main_action = get_agent_name() + "-main";
787  fprintf(f, "graph: { title: \"%s\" label: \"%s\" \n\
788  status: folded \n\
789  display_edge_labels: yes \n\
790  layoutalgorithm: tree \n\
791  scaling: maxspect \n\
792  color : lightred \n\
793  node.color : lightblue \n\
794  node.textcolor : black \n\
795  node.bordercolor: black \n\
796  node.borderwidth: 1 \n\
797  edge.color : lightblue \n\
798  edge.arrowsize : 7 \n\
799  edge.thickness : 2 \n\
800  edge.fontname:\"helvO08\" \n\
801  node.label: \"no type\" \n", main_action.c_str(), main_action.c_str());
802 
803  for (i=0; i<bcScheduler.size(); i++)
804  bcScheduler[i]->print(f, get_agent_name().c_str());
805 
806  gmScheduler.print(f, get_agent_name().c_str());
807 
808  std::string main_physics = get_agent_name() + "-physics";
809  fprintf(f, "node: { title:\"%s\" label:\"%s\"}\n", main_physics.c_str(), main_physics.c_str());
810 
811  fprintf(f, "}\n");
812 
813  if (bcinit) {
814  fprintf(f, "edge: { sourcename: \"%s\" targetname: \"%s\" label: \"\"}\n", bcinit, main_action.c_str());
815  free(bcinit);
816  }
817 
818  fprintf(f, "}\n");
819 }
SchdulerList bcScheduler
Definition: Agent.h:117
std::string get_agent_name() const
Definition: Agent.h:223
void print(FILE *f)
Definition: Agent.C:762
void print(const char *fname)
Definition: Scheduler.C:244
blockLoc i
Definition: read.cpp:79
UserScheduler gmScheduler
Definition: Agent.h:119
UserScheduler bcInitScheduler
Definition: Agent.h:118

Here is the call graph for this function:

Here is the caller graph for this function:

int read_by_control_file ( double  t,
const std::string  base,
const std::string  window 
)
protected

Definition at line 588 of file Agent.C.

References COM_call_function(), comm_rank, COMMPI_Comm_rank(), communicator, cimg_library::cimg::fopen(), get_agent_name(), get_time_string(), inDir, MAN_DEBUG, man_verbose, outDir, read_by_control_handle, and skipInputIO.

Referenced by BurnAgent::input(), FluidAgent::input(), and SolidAgent::input().

588  {
589 
590  if (skipInputIO) return 0; // physics module does input itself
591 
592  // Read in surface window
593  std::string fname = inDir; fname.append( base); fname.append("_in_");
594 
595  std::string timeLevel; get_time_string( t, timeLevel);
596  fname.append( timeLevel); fname.append( ".txt");
597 
598  MAN_DEBUG(3, ("[%d] Agent %s::read_by_control_file run with file: %s t:%e.\n", comm_rank, get_agent_name().c_str(), fname.c_str(), t));
599 
600  bool ctrl_exist;
601  FILE *fp = fopen( fname.c_str(), "r");
602  ctrl_exist = (fp!=NULL);
603  if ( !ctrl_exist && t!=0.0 ) {
604  fname = outDir + base + "_in_" + timeLevel + ".txt";
605  fp = fopen( fname.c_str(), "r");
606  ctrl_exist = (fp!=NULL);
607  }
608 
610  if ( ctrl_exist) {
611  if (comm_rank==0 && man_verbose > 2)
612  std::cout << "Rocstar: Found control file " << fname << std::endl;
613 
614  COM_call_function( read_by_control_handle, fname.c_str(),
615  window.c_str(), &communicator);
616  return 0;
617  }
618  else {
619  if (comm_rank==0 && man_verbose > 2)
620  std::cout << "Rocstar: Did not find control file " << fname << std::endl;
621  return -1;
622  }
623 }
int COMMPI_Comm_rank(MPI_Comm c)
Definition: commpi.h:162
string outDir
Definition: Agent.h:142
std::string get_agent_name() const
Definition: Agent.h:223
int man_verbose
void get_time_string(double t, std::string &s)
Definition: Agent.C:578
string inDir
Definition: Agent.h:142
MPI_Comm communicator
Definition: Agent.h:114
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
static int read_by_control_handle
Definition: Agent.h:123
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
bool skipInputIO
Definition: Agent.h:164
std::FILE * fopen(const char *const path, const char *const mode)
Open a file, and check for possible errors.
Definition: CImg.h:5494
int comm_rank
Definition: Agent.h:130

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void read_restart_data ( )
inlinevirtual

Reimplemented in SolidAgent, BurnAgent, and FluidAgent.

Definition at line 193 of file Agent.h.

193 {}
void register_clone_attribute ( int  cond,
std::string  target_window_,
std::string  attr_,
std::string  parent_window_,
std::string  parent_attr_,
int  wg_ = 1,
const char *  ptnname_ = 0,
int  val_ = 0 
)

Definition at line 328 of file Agent.C.

References attributeList.

Referenced by ComputeFluidLoad_ALE::ComputeFluidLoad_ALE(), HeatTransfer_FS::HeatTransfer_FS(), LoadTransfer_FS::LoadTransfer_FS(), LoadTransfer_FSc_ALE::LoadTransfer_FSc_ALE(), LoadTransferOnly_FSc_ALE::LoadTransferOnly_FSc_ALE(), MeshMotionTransfer_SF::MeshMotionTransfer_SF(), MeshMotionTransferISS::MeshMotionTransferISS(), RemeshInit::RemeshInit(), and TemperatureTransfer_SF::TemperatureTransfer_SF().

329 {
330  CloneAttribute *newAttr = new CloneAttribute(this, cond, target_window_, attr_, parent_window_, parent_attr_, wg_, ptnname_, val_);
331  attributeList.push_back(newAttr);
332 }
AttributeList attributeList
Definition: Agent.h:156

Here is the caller graph for this function:

void register_interpolate ( InterpolateBase ip)

Definition at line 625 of file Agent.C.

References interpolateList.

Referenced by InterpolateBase::InterpolateBase().

626 {
627  interpolateList.push_back(ip);
628 }
InterpolateList interpolateList
Definition: Agent.h:153

Here is the caller graph for this function:

void register_new_attribute ( std::string  target_window_,
std::string  attr_,
char  loc_,
int  type_,
int  ncomp_,
const char *  unit_ 
)
void register_use_attribute ( std::string  target_window_,
std::string  attr_,
std::string  parent_window_,
std::string  parent_attr_,
int  wg_ = 1,
const char *  ptnname_ = 0,
int  val_ = 0 
)

Definition at line 334 of file Agent.C.

References attributeList.

Referenced by MassTransfer::MassTransfer(), and MassTransfer_SF_ALE::MassTransfer_SF_ALE().

335 {
336  UseAttribute *newAttr = new UseAttribute(this, target_window_, attr_, parent_window_, parent_attr_, wg_, ptnname_, val_);
337  attributeList.push_back(newAttr);
338 }
AttributeList attributeList
Definition: Agent.h:156

Here is the caller graph for this function:

void run_bcinitaction ( double  t,
double  dt 
)

Definition at line 562 of file Agent.C.

References bcInitScheduler, dobackup, get_agent_name(), get_coupling(), i, interpolateList, MAN_DEBUG, and Scheduler::run_actions().

Referenced by BCInitInvoker::run(), and PhysicsAction::run().

563 {
564  MAN_DEBUG(3, ("Rocstar: %s::run_bcinitaction called t=%e dt=%e.\n", get_agent_name().c_str(), t, dt));
565 
566  // backup first
567  if (get_coupling()->get_ipc() <= 1 && dobackup == 1)
568  for (unsigned int i=0; i<interpolateList.size(); i++)
569  interpolateList[i]->backup();
570 
572 }
std::string get_agent_name() const
Definition: Agent.h:223
InterpolateList interpolateList
Definition: Agent.h:153
Coupling * get_coupling()
Definition: Agent.h:213
blockLoc i
Definition: read.cpp:79
int dobackup
Definition: Agent.h:139
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
UserScheduler bcInitScheduler
Definition: Agent.h:118
void run_actions(double t, double dt)
Definition: Scheduler.C:339

Here is the call graph for this function:

Here is the caller graph for this function:

void schedule ( )

Definition at line 456 of file Agent.C.

References bcInitScheduler, bcScheduler, gmScheduler, i, icScheduler, and UserScheduler::schedule().

457 {
460  for (unsigned int i=0; i<bcScheduler.size(); i++) {
461  bcScheduler[i]->schedule();
462  }
464 }
SchdulerList bcScheduler
Definition: Agent.h:117
virtual void schedule()
Definition: Scheduler.C:408
blockLoc i
Definition: read.cpp:79
UserScheduler gmScheduler
Definition: Agent.h:119
UserScheduler bcInitScheduler
Definition: Agent.h:118
UserScheduler icScheduler
Definition: Agent.h:120

Here is the call graph for this function:

void split_surface_window ( const std::string  surfAll,
const std::string  surf_i,
const std::string  surf_nb,
const std::string  surf_b,
const std::string  surf_ni 
)
protected

Definition at line 690 of file Agent.C.

References COM_get_window_handle(), COM_new_window(), COM_use_attribute(), and COM_window_init_done().

Referenced by SolidAgent::create_buffer_all().

694  {
695  std::string bcflag = surfAll+".bcflag";
696  std::string atts = surfAll+".all";
697 
698  if (COM_get_window_handle(surf_i) <= 0)
699  COM_new_window( surf_i);
700  COM_use_attribute( surf_i, atts, 0, bcflag.c_str(), 0);
701  COM_use_attribute( surf_i, atts, 0, bcflag.c_str(), 1);
702  COM_window_init_done( surf_i);
703 
704  if (COM_get_window_handle(surf_nb) <= 0)
705  COM_new_window( surf_nb); // bcflag ==0
706  COM_use_attribute( surf_nb, atts, 1, bcflag.c_str(), 0);
707  COM_window_init_done( surf_nb);
708 
709  if (COM_get_window_handle(surf_b) <= 0)
710  COM_new_window( surf_b); // bcflag ==1
711  COM_use_attribute( surf_b, atts, 1, bcflag.c_str(), 1);
712  COM_window_init_done( surf_b);
713 
714  if (COM_get_window_handle(surf_ni) <= 0)
715  COM_new_window( surf_ni); // bcflag ==2
716  COM_use_attribute( surf_ni, atts, 1, bcflag.c_str(), 2);
717  COM_window_init_done( surf_ni);
718 }
void COM_use_attribute(const char *wname, const char *attr, int wg=1, const char *ptnname=0, int val=0)
Use the subset of panes of another window of which the given pane attribute has value val...
Definition: roccom_c++.h:224
void COM_window_init_done(const char *w_str, int pane_changed=true)
Definition: roccom_c++.h:102
void COM_new_window(const char *wname, MPI_Comm c=MPI_COMM_NULL)
Definition: roccom_c++.h:86
int COM_get_window_handle(const char *wname)
Definition: roccom_c++.h:404

Here is the call graph for this function:

Here is the caller graph for this function:

void store_solutions ( int  converged)
protectedvirtual

Definition at line 725 of file Agent.C.

References COM_copy_attribute(), comm_rank, get_agent_name(), i, MAN_DEBUG, pc_count, and pc_hdls.

Referenced by init_convergence().

726 {
727  int i;
728  if(comm_rank == 0)
729  MAN_DEBUG(3, ("[%d] Agent %s::store_solutions converged=%d.\n", comm_rank, get_agent_name().c_str(), converged));
730 
731  if ( converged) { // Store internal data
732  for (i=0; i<pc_count; i++)
733  if ( pc_hdls[0][i]>0)
734  COM_copy_attribute( pc_hdls[1][i], pc_hdls[0][i]);
735  }
736  else {
737  for (i=0; i<pc_count; i++)
738  if ( pc_hdls[0][i]>0)
739  COM_copy_attribute( pc_hdls[0][i], pc_hdls[1][i]);
740  }
741 }
std::string get_agent_name() const
Definition: Agent.h:223
int pc_hdls[2][3]
Definition: Agent.h:158
blockLoc i
Definition: read.cpp:79
void COM_copy_attribute(const char *wname, const char *attr, int wg=1, const char *ptnname=0, int val=0)
Copy an attribute onto another.
Definition: roccom_c++.h:244
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
int pc_count
Definition: Agent.h:160
int comm_rank
Definition: Agent.h:130

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void unload_module ( )
inlinevirtual

Reimplemented in SolidAgent, BurnAgent, and FluidAgent.

Definition at line 170 of file Agent.h.

170 {}
void write_control_file ( double  t,
const std::string  base,
const std::string  window 
)
protected

Definition at line 657 of file Agent.C.

References COM_call_function(), comm_rank, get_agent_name(), get_coupling(), Coupling::get_rocmancontrol_param(), get_time_string(), MAN_DEBUG, outDir, RocmanControl_parameters::separate_out, and write_ctrl_handle.

Referenced by BurnAgent::output_restart_files(), FluidAgent::output_restart_files(), and SolidAgent::output_restart_files().

657  {
658  int separate_out = get_coupling()->get_rocmancontrol_param()->separate_out;
659  // Read in surface window
660  std::string fname; // = base; fname.append("_");
661 /*
662  if (separate_out) {
663  std::ostringstream rank;
664  rank << comm_rank;
665  fname += rank.str(); fname.append( "/");
666  }
667 */
668  fname.append( base);
669  fname.append("_");
670 
671  std::string timeLevel; get_time_string( t, timeLevel);
672  fname.append( timeLevel); fname.append("_");
673 
674  std::string ctrl_fname = outDir; ctrl_fname.append( base);
675  // If base contains '*', then remove it
676  std::string::size_type pos = ctrl_fname.find('*');
677  if ( pos != std::string::npos) ctrl_fname.erase( pos);
678  ctrl_fname.append("_in_"); ctrl_fname.append( timeLevel);
679  ctrl_fname.append(".txt");
680 
681  MAN_DEBUG(3, ("[%d] Rocstar: Agent %s::write_control_file %s with file prefix %s at t:%e.\n", comm_rank, get_agent_name().c_str(), ctrl_fname.c_str(), fname.c_str(), t));
682 
683  COM_call_function( write_ctrl_handle, window.c_str(), fname.c_str(),
684  ctrl_fname.c_str());
685 }
string outDir
Definition: Agent.h:142
std::string get_agent_name() const
Definition: Agent.h:223
void get_time_string(double t, std::string &s)
Definition: Agent.C:578
Coupling * get_coupling()
Definition: Agent.h:213
static int write_ctrl_handle
Definition: Agent.h:127
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
const RocmanControl_parameters * get_rocmancontrol_param()
Definition: Coupling.h:184
int comm_rank
Definition: Agent.h:130

Here is the call graph for this function:

Here is the caller graph for this function:

void write_data_files ( double  t,
const std::string  base,
const std::string  attr,
const char *  ref = NULL 
)
protected

Definition at line 631 of file Agent.C.

References COM_call_function(), COM_get_attribute_handle(), comm_rank, communicator, get_agent_name(), get_coupling(), Coupling::get_rocmancontrol_param(), get_time_string(), MAN_DEBUG, outDir, RocmanControl_parameters::separate_out, and write_attr_handle.

Referenced by BurnAgent::output_restart_files(), FluidAgent::output_restart_files(), and SolidAgent::output_restart_files().

632  {
633  int separate_out = get_coupling()->get_rocmancontrol_param()->separate_out;
634  // Read in surface window
635  std::string fname = outDir;
636 /*
637  if (separate_out) {
638  std::ostringstream rank;
639  rank << comm_rank;
640  fname += rank.str();
641  fname.append( "/");
642  }
643 */
644  fname.append( base); fname.append("_");
645 
646  std::string timeLevel; get_time_string( t, timeLevel);
647  fname.append( timeLevel); fname.append("_");
648 
649  MAN_DEBUG(3, ("[%d] Rocstar: Agent %s::write_data_file with file prefix %s at t:%e.\n", comm_rank, get_agent_name().c_str(), fname.c_str(), t));
650 
651  int attr_hdl = COM_get_attribute_handle( attr);
652  COM_call_function( write_attr_handle, fname.c_str(), &attr_hdl,
653  base.c_str(), timeLevel.c_str(), ref, &communicator);
654 }
string outDir
Definition: Agent.h:142
std::string get_agent_name() const
Definition: Agent.h:223
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
void get_time_string(double t, std::string &s)
Definition: Agent.C:578
Coupling * get_coupling()
Definition: Agent.h:213
static int write_attr_handle
Definition: Agent.h:126
MPI_Comm communicator
Definition: Agent.h:114
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
const RocmanControl_parameters * get_rocmancontrol_param()
Definition: Coupling.h:184
int comm_rank
Definition: Agent.h:130

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class PhysicsAction
friend

Definition at line 111 of file Agent.h.

Member Data Documentation

PhysicsAction action
protected

Definition at line 116 of file Agent.h.

Referenced by Agent(), Coupling::Interrupt(), and Coupling::ProcessInterrupt().

const std::string agent_name
protected

Definition at line 113 of file Agent.h.

Referenced by Agent().

int bc_handle
protected

Definition at line 136 of file Agent.h.

Referenced by create_window(), and PhysicsAction::run().

UserScheduler bcInitScheduler
protected
SchdulerList bcScheduler
protected

Definition at line 117 of file Agent.h.

Referenced by add_bcaction(), callMethod(), finalize(), init_bcactions(), obtain_bc(), print(), and schedule().

int compute_integrals_handle
protected
Coupling* coupling
protected

Definition at line 115 of file Agent.h.

double current_deltatime
protected

Definition at line 144 of file Agent.h.

Referenced by init_callback(), init_module(), obtain_bc(), obtain_gm(), and PhysicsAction::run().

double current_time
protected

Definition at line 144 of file Agent.h.

Referenced by init_callback(), init_module(), and PhysicsAction::run().

int dobackup
protected

Definition at line 139 of file Agent.h.

Referenced by Agent(), FluidAgent::FluidAgent(), and run_bcinitaction().

int finalize_handle
protected

Definition at line 133 of file Agent.h.

Referenced by finalize(), and init_function_handles().

int gm_handle
protected

Definition at line 136 of file Agent.h.

Referenced by create_window(), and PhysicsAction::run().

UserScheduler gmScheduler
protected

Definition at line 119 of file Agent.h.

Referenced by add_gmaction(), Agent(), callMethod(), finalize(), init_gmactions(), obtain_gm(), print(), and schedule().

int ic_handle
protected
UserScheduler icScheduler
protected

Definition at line 120 of file Agent.h.

Referenced by add_icaction(), finalize(), init_callback(), and schedule().

string inDir
protected

Definition at line 142 of file Agent.h.

Referenced by Agent(), and read_by_control_file().

int init_handle
protected
double initial_time
protected

Definition at line 144 of file Agent.h.

Referenced by init_module().

double integrals[MAN_INTEG_SIZE]
protected

Definition at line 162 of file Agent.h.

Referenced by FluidAgent::compute_integrals(), and SolidAgent::compute_integrals().

InterpolateList interpolateList
protected

Definition at line 153 of file Agent.h.

Referenced by register_interpolate(), and run_bcinitaction().

double old_dt
protected

Definition at line 144 of file Agent.h.

Referenced by Agent(), init_module(), and PhysicsAction::run().

void* option_data
protected

Definition at line 150 of file Agent.h.

Referenced by init_callback(), and BurnAgent::init_module().

string outDir
protected

Definition at line 142 of file Agent.h.

Referenced by Agent(), read_by_control_file(), write_control_file(), and write_data_files().

int pc_count
protected
int pc_hdls[2][3]
protected
int post_hdf_handle
protected

Definition at line 132 of file Agent.h.

Referenced by init_function_handles(), and FluidAgent::output_restart_files().

int pre_hdf_handle
protected

Definition at line 132 of file Agent.h.

Referenced by init_function_handles(), and FluidAgent::output_restart_files().

int read_by_control_handle =0
staticprotected

Definition at line 123 of file Agent.h.

Referenced by init_function_handles(), and read_by_control_file().

int read_files_handle =0
staticprotected

Definition at line 124 of file Agent.h.

Referenced by init_function_handles().

bool skipInputIO
protected

Definition at line 164 of file Agent.h.

Referenced by read_by_control_file().

string suffix
protected

Definition at line 142 of file Agent.h.

Referenced by Agent().

double timestamp
protected

Definition at line 144 of file Agent.h.

Referenced by Agent(), obtain_bc(), and PhysicsAction::run().

std::string tmp_window
protected
int update_handle
protected

Definition at line 131 of file Agent.h.

Referenced by init_function_handles(), and PhysicsAction::run().

bool withgm
protected

Definition at line 137 of file Agent.h.

Referenced by PhysicsAction::run().

int write_attr_handle =0
staticprotected

Definition at line 126 of file Agent.h.

Referenced by init_function_handles(), and write_data_files().

int write_ctrl_handle =0
staticprotected

Definition at line 127 of file Agent.h.

Referenced by init_function_handles(), and write_control_file().


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