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

#include <Interpolate.h>

Inheritance diagram for Extrapolate_Linear:
Collaboration diagram for Extrapolate_Linear:

Public Member Functions

 Extrapolate_Linear (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 50 of file Interpolate.h.

Constructor & Destructor Documentation

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

Definition at line 137 of file Interpolate.C.

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

137  : InterpolateBase(ag, bkag, cond)
138 {
139  action_name = (char *)"Extrapolate_Linear";
140  // INIT_INTERP_HANDLES() in "man_basic.f90"
141  std::string atts[4];
142  atts[0] = attr;
143  atts[1] = attr + "_old";
144  atts[2] = attr + alpsuf;
145  atts[3] = attr + "_grad";
146 
147  set_attr(4, atts);
148 
149  // Define I/O of the arguments.
150  int io[] = {IN, IN, OUT, IN};
151  set_io( 4, io);
152 }
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 154 of file Interpolate.C.

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

155 {
156  // check condition
157  attr_hdls[2] = COM_get_attribute_handle(attr[2]); // alp
158  if (conditional) {
159  if (attr_hdls[2] <= 0) return;
160  }
161 
163 }
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
char ** attr
Definition: Action.h:37
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 165 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.

166 {
167  if (attr_hdls[2] <= 0) return;
168 
169  MAN_DEBUG(3, ("Extrapolate_Linear::run (%s) called with t:%e dt:%e alpha:%e.\n", attr[0], t, dt, alpha));
170 
171  COM_assertion_msg(alpha>=-1.e-6 && alpha <= 1+1.e-6, "ERROR: Abort!");
172 
173  int order = agent->get_coupling()->get_rocmancontrol_param()->order;
174  if (order == 0 || agent->get_coupling()->new_start(t)) {
176  return;
177  }
178 
179  if (agent->get_coupling()->get_ipc() <= 1 && attr_hdls[3] <= 0) {
181  return;
182  }
183  double base = 0.0;
184  // linear interpolation.
185  extrapolate_Linear(dt, agent->get_old_dt(), base, attr_hdls[1], base+1.0, attr_hdls[0], alpha, attr_hdls[2], attr_hdls[3]);
186 }
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: