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

#include <Interpolate.h>

Inheritance diagram for Extrapolate_Central:
Collaboration diagram for Extrapolate_Central:

Public Member Functions

 Extrapolate_Central (Agent *ag, Agent *bkag, const std::string attr, const std::string alpsuf="_alp", int cond=0)
 
virtual void init (double t)
 
void run (double t, double dt, double alpha)
 
- Public Member Functions inherited from InterpolateBase
 InterpolateBase (Agent *ag, Agent *bkag, int cond=0)
 
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 57 of file Interpolate.h.

Constructor & Destructor Documentation

Extrapolate_Central ( Agent ag,
Agent bkag,
const std::string  attr,
const std::string  alpsuf = "_alp",
int  cond = 0 
)

Definition at line 188 of file Interpolate.C.

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

188  : InterpolateBase(ag, bkag, cond)
189 {
190  action_name = (char *)"Extrapolate_Central";
191  // INIT_INTERP_HANDLES() in "man_basic.f90"
192  std::string atts[4];
193  atts[0] = attr;
194  atts[1] = attr + "_old";
195  atts[2] = attr + alpsuf;
196  atts[3] = attr + "_grad";
197 
198  set_attr(4, atts);
199 
200  // Define I/O of the arguments.
201  int io[] = {IN, IN, OUT, IN};
202  set_io( 4, io);
203 
204 /*
205  // register attributes
206  std::string surf_win = agent->get_surface_window();
207  std::string::size_type pos = attr.find(".");
208  std::string wname, aname;
209  if ( pos == std::string::npos) {
210  COM_assertion_msg(0, "ERROR: Here!");
211  }
212  else {
213  wname = attr.substr( 0, pos);
214  aname = attr.substr( pos, attr.size()-pos);
215  }
216 
217  agent->register_use_attribute( wname, aname, ((BurnAgent*)agent)->parentWin, aname); // attr
218  agent->register_clone_attribute( conditional, wname, aname+"_old", surf_win, aname+"_alp"); // attr_old
219  agent->register_clone_attribute( conditional, wname, aname+"_grad", surf_win, aname+"_alp"); // attr_grad
220 */
221 }
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 init ( double  t)
virtual

Reimplemented from InterpolateBase.

Definition at line 223 of file Interpolate.C.

References Action::attr, InterpolateBase::attr_hdls, COM_assertion_msg, COM_get_attribute_handle(), COM_get_window_handle(), InterpolateBase::conditional, and InterpolateBase::init().

224 {
225  // check condition
226  // first check if window exists
227  std::string attribute = attr[0];
228  std::string::size_type pos = attribute.find(".");
229  COM_assertion_msg(pos != std::string::npos, "ERROR: Here!");
230  std::string wname = attribute.substr( 0, pos);
231  if (COM_get_window_handle(wname) <= 0) return;
232 
233  // check if attribute exists
234  attr_hdls[2] = COM_get_attribute_handle(attr[2]); // alp
235  if (conditional) {
236  if (attr_hdls[2] <= 0) return;
237  }
238 
240 }
#define COM_assertion_msg(EX, msg)
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
char ** attr
Definition: Action.h:37
int COM_get_window_handle(const char *wname)
Definition: roccom_c++.h:404
virtual void init(double t)
Definition: Interpolate.C:43
int attr_hdls[4]
Definition: Interpolate.h:44

Here is the call graph for this function:

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

Implements InterpolateBase.

Definition at line 242 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(), Coupling::get_ipc(), Agent::get_old_dt(), Coupling::get_rocmancontrol_param(), MAN_DEBUG, Coupling::new_start(), and RocmanControl_parameters::order.

243 {
244  if (attr_hdls[2] <= 0) return;
245 
246  MAN_DEBUG(3, ("Extrapolate_Central::run (%s) called with t:%e dt:%e alpha:%e.\n", attr[0], t, dt, alpha));
247 
248  COM_assertion_msg(alpha>=0.0, "ERROR: Extrapolate_Central called with invalid alpha!");
249 
250  COM_assertion_msg(alpha>=-1.e-6 && alpha <= 1+1.e-6, "ERROR: Abort!");
251 
252  int order = agent->get_coupling()->get_rocmancontrol_param()->order;
253  if (order == 0 || agent->get_coupling()->new_start(t)) {
255  return;
256  }
257 
258  if (agent->get_coupling()->get_ipc() <= 1 && attr_hdls[3] <= 0) {
260  return;
261  }
262  double base = -0.5;
263  // linear interpolation.
264  extrapolate_Linear(dt, agent->get_old_dt(), base, attr_hdls[1], base+1.0, attr_hdls[0], alpha, attr_hdls[2], attr_hdls[3]);
265 }
double get_old_dt() const
Definition: Agent.h:226
#define COM_assertion_msg(EX, msg)
int get_ipc() const
Definition: Coupling.h:160
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: