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

#include <Interpolate.h>

Inheritance diagram for Interpolate_Central:
Collaboration diagram for Interpolate_Central:

Public Member Functions

 Interpolate_Central (Agent *ag, Agent *bkag, const std::string attr, const std::string alpsuf="_alp")
 
void run (double t, double dt, double alpha)
 
- Public Member Functions inherited from InterpolateBase
 InterpolateBase (Agent *ag, Agent *bkag, int cond=0)
 
virtual void init (double t)
 
void backup ()
 
- Public Member Functions inherited from Action
 Action (void *p=0, char *name=NULL)
 
 Action (int n, const char *at[], int *i=NULL, void *p=0, char *name=NULL)
 
 Action (int n, const std::string at[], int *i=NULL, void *p=0, char *name=NULL)
 
virtual ~Action ()
 
virtual void declare (Scheduler &)
 
virtual void finalize ()
 
virtual char * name ()
 
void set_name (const char *name)
 
virtual void print (FILE *f)
 
virtual void print_toposort (FILE *f)
 
virtual void schedule ()
 

Additional Inherited Members

- Protected Types inherited from Action
enum  { IN =1, OUT =2, INOUT =3 }
 
- Protected Member Functions inherited from InterpolateBase
void extrapolate_Linear (double dt, double dt_old, double time_old, int a_old, double time_new, int a_new, double time_out, int a_out, int a_gra=-100)
 
- Protected Member Functions inherited from Action
int get_attribute_handle (int i)
 
int get_attribute_handle_const (int i)
 
int get_attribute_handle (const std::string str)
 
void set_attr (int n, const std::string at[], int *id=NULL)
 
void set_attr (int n, const char *at[], int *id=NULL)
 
void set_io (int n, const int *io)
 
void set_io (const char *io)
 
int get_io (int i)
 
- Protected Attributes inherited from InterpolateBase
Agentagent
 
Agentbkagent
 
int attr_hdls [4]
 
int bkup_hdls [3]
 
int conditional
 
int on
 
- Protected Attributes inherited from Action
char * action_name
 
char ** attr
 
int * idx
 
int count
 
void * usr_ptr
 
std::vector< int > inout
 

Detailed Description

Definition at line 76 of file Interpolate.h.

Constructor & Destructor Documentation

Interpolate_Central ( Agent ag,
Agent bkag,
const std::string  attr,
const std::string  alpsuf = "_alp" 
)

Definition at line 345 of file Interpolate.C.

References Action::action_name, Action::attr, Action::IN, Action::OUT, Action::set_attr(), and Action::set_io().

345  : InterpolateBase(ag, bkag)
346 {
347  action_name = (char *)"Interpolate_Central";
348  // INIT_INTERP_HANDLES() in "man_basic.f90"
349  std::string atts[4];
350  atts[0] = attr;
351  atts[1] = attr + "_old";
352  atts[2] = attr + alpsuf;
353  atts[3] = attr + "_grad";
354 
355  set_attr(4, atts);
356 
357  // Define I/O of the arguments.
358  int io[] = {IN, IN, OUT, IN};
359  set_io( 4, io);
360 
361 /*
362  // register attributes
363  std::string surf_win = agent->get_surface_window();
364  std::string::size_type pos = attr.find(".");
365  std::string wname, aname;
366  if ( pos == std::string::npos) {
367  COM_assertion_msg(0, "ERROR: Here!");
368  }
369  else {
370  wname = attr.substr( 0, pos);
371  aname = attr.substr( pos, attr.size()-pos);
372  }
373 
374  if (attr_action[0] == 'n')
375  agent->register_new_attribute( wname, aname, 'e', COM_DOUBLE, 1, "kg/(m^2 s)");
376 
377  if (attr_action[1] == 'n')
378  agent->register_new_attribute( wname, aname+"_old", 'e', COM_DOUBLE, 1, "kg/(m^2 s)");
379  else if (attr_action[1] == 'c')
380  agent->register_clone_attribute( 0, wname, aname+"_old", surf_win, aname); // attr_old
381 
382  if (attr_action[2] == 'c')
383  agent->register_clone_attribute( 0, wname, aname+alpsuf, surf_win, aname); // attr_grad
384 
385  if (attr_action[3] == 'n')
386  agent->register_new_attribute( wname, aname+"_grad", 'e', COM_DOUBLE, 1, "kg/(m^2 s)");
387  else if (attr_action[3] == 'c')
388  agent->register_clone_attribute( 0, wname, aname+"_grad", surf_win, aname); // attr_grad
389 */
390 }
InterpolateBase(Agent *ag, Agent *bkag, int cond=0)
Definition: Interpolate.C:30
char * action_name
Definition: Action.h:36
char ** attr
Definition: Action.h:37
void set_io(int n, const int *io)
Definition: Action.h:70
void set_attr(int n, const std::string at[], int *id=NULL)
Definition: Action.C:66

Here is the call graph for this function:

Member Function Documentation

void run ( double  t,
double  dt,
double  alpha 
)
virtual

Implements InterpolateBase.

Definition at line 392 of file Interpolate.C.

References InterpolateBase::agent, Action::attr, InterpolateBase::attr_hdls, COM_assertion_msg, COM_call_function(), RocBlas::copy, InterpolateBase::extrapolate_Linear(), Agent::get_coupling(), Agent::get_old_dt(), Coupling::get_rocmancontrol_param(), MAN_DEBUG, Coupling::new_start(), and RocmanControl_parameters::order.

393 {
394  if (attr_hdls[2] <= 0) return;
395 
396  MAN_DEBUG(3, ("Interpolate_Central::run (%s) called with t:%e dt:%e alpha:%e.\n", attr[0], t, dt, alpha));
397 
398  COM_assertion_msg(alpha>=0.0, "ERROR: Extrapolate_Central called with invalid alpha!");
399 
400  COM_assertion_msg(alpha>=-1.e-6 && alpha <= 1+1.e-6, "ERROR: Abort!");
401 
402  int order = agent->get_coupling()->get_rocmancontrol_param()->order;
403  if (order == 0 || agent->get_coupling()->new_start(t)) {
405  return;
406  }
407 
408  double base = -0.5;
409 
410  // linear interpolation.
411  extrapolate_Linear(dt, agent->get_old_dt(), base, attr_hdls[1], base+1.0, attr_hdls[0], alpha, attr_hdls[2], attr_hdls[3]);
412 }
double get_old_dt() const
Definition: Agent.h:226
#define COM_assertion_msg(EX, msg)
static int copy
Definition: RocBlas.h:34
char ** attr
Definition: Action.h:37
Coupling * get_coupling()
Definition: Agent.h:213
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
int new_start(double t) const
Definition: Coupling.C:170
int attr_hdls[4]
Definition: Interpolate.h:44
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
const RocmanControl_parameters * get_rocmancontrol_param()
Definition: Coupling.h:184
void extrapolate_Linear(double dt, double dt_old, double time_old, int a_old, double time_new, int a_new, double time_out, int a_out, int a_gra=-100)
Definition: Interpolate.C:94

Here is the call graph for this function:


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