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

#include <Interpolate.h>

Inheritance diagram for InterpolateBase:
Collaboration diagram for InterpolateBase:

Public Member Functions

 InterpolateBase (Agent *ag, Agent *bkag, int cond=0)
 
virtual void init (double t)
 
virtual void run (double t, double dt, double alpha)=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 ()
 

Protected Member Functions

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

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
 

Additional Inherited Members

- Protected Types inherited from Action
enum  { IN =1, OUT =2, INOUT =3 }
 

Detailed Description

Definition at line 31 of file Interpolate.h.

Constructor & Destructor Documentation

InterpolateBase ( Agent ag,
Agent bkag,
int  cond = 0 
)

Definition at line 30 of file Interpolate.C.

References attr_hdls, bkagent, bkup_hdls, i, on, and Agent::register_interpolate().

30  :
31  Action(0, (const char**)NULL, NULL, NULL, (char *)"InterpolateBase"),
32  agent(ag), bkagent(bkag), conditional(cond)
33 {
34  // register to Agent for create_attribute() and backup() callback
36 
37  int i;
38  for (i=0; i<4; i++) attr_hdls[i] = -1;
39  for (i=0; i<3; i++) bkup_hdls[i] = -1;
40  on = 1;
41 }
int bkup_hdls[3]
Definition: Interpolate.h:45
blockLoc i
Definition: read.cpp:79
void register_interpolate(InterpolateBase *ip)
Definition: Agent.C:625
Action(void *p=0, char *name=NULL)
Definition: Action.C:32
int attr_hdls[4]
Definition: Interpolate.h:44
Agent * bkagent
Definition: Interpolate.h:43

Here is the call graph for this function:

Member Function Documentation

void backup ( )

Definition at line 71 of file Interpolate.C.

References agent, Action::attr, bkup_hdls, COM_call_function(), RocBlas::copy, RocBlas::copy_scalar, RocBlas::div_scalar, Agent::get_old_dt(), MAN_DEBUG, RocBlas::sub, and v.

72 {
73  MAN_DEBUG(3, ("Rocstar: InterpolateBase::backup (%s) called with dt_old:%e.\n", attr[0], agent->get_old_dt()));
74 
75  // BACKUP() in "man_basic.f90"
76  if (bkup_hdls[0] > 0 && bkup_hdls[1] > 0) {
77  // Compute gradient
78  if ( bkup_hdls[2] > 0) {
79  double dt_old = agent->get_old_dt();
80  if (dt_old > 0.) {
83  }
84  else {
85  double v = 0.0;
87  }
88  }
90  }
91 }
double get_old_dt() const
Definition: Agent.h:226
int bkup_hdls[3]
Definition: Interpolate.h:45
static int copy
Definition: RocBlas.h:34
static int copy_scalar
Definition: RocBlas.h:43
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
char ** attr
Definition: Action.h:37
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
static int sub
Definition: RocBlas.h:36
static int div_scalar
Definition: RocBlas.h:46

Here is the call graph for this function:

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

Definition at line 94 of file Interpolate.C.

References RocBlas::axpy_scalar, COM_assertion_msg, COM_call_function(), RocBlas::copy, RocBlas::div_scalar, RocBlas::limit1, RocBlas::sub, and cimg_library::cimg::time().

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

95 {
96 
97  //printf("extrapolate_Linear: %f %d %f %d %f %d %d\n", time_old, a_old, time_new, a_new, time_out, a_out, a_grad);
98 
99  if (time_out == time_new) {
100  COM_call_function( RocBlas::copy, &a_new, &a_out);
101  }
102  else if (a_old <= 0) {
103  printf("Rocstar Error: Could not find the old attribute correspond to the attribute with handle %d\n", a_out);
104  COM_assertion_msg(0, "ERROR: Abort!");
105  }
106  else if (time_out == time_old) {
107  COM_call_function( RocBlas::copy, &a_old, &a_out);
108  }
109  else {
110  // See the interpolation section in developers' guide for the algorithm
111  COM_call_function( RocBlas::sub, &a_new, &a_old, &a_out);
112  double a;
113  if (time_old == 0.)
114  a = time_out-1.;
115  else if (time_old == -0.5) {
116  if (a_grad != -100 && a_grad>0) {
117  double time = (dt_old+dt)/2.0;
118  COM_call_function( RocBlas::div_scalar, &a_out, &time, &a_out);
119  COM_call_function( RocBlas::limit1, &a_grad, &a_out, &a_out);
120  a = (time_out - 0.5)*dt;
121  }
122  else
123  a = 2.*(time_out - 0.5)*dt/(dt_old+dt);
124  }
125  else if (time_old == -1) {
126  COM_assertion_msg(0, "ERROR: Abort!");
127  }
128  else {
129  printf("Rocstar Error: Unsupported interpolation mode with old time stamp %f\n", time_old);
130  COM_assertion_msg(0, "ERROR: Abort!");
131  }
132  COM_call_function( RocBlas::axpy_scalar, &a, &a_out, &a_new, &a_out);
133  }
134 }
static int limit1
Definition: RocBlas.h:37
static int axpy_scalar
Definition: RocBlas.h:45
#define COM_assertion_msg(EX, msg)
static int copy
Definition: RocBlas.h:34
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
unsigned long time()
Get the value of a system timer with a millisecond precision.
Definition: CImg.h:4605
static int sub
Definition: RocBlas.h:36
static int div_scalar
Definition: RocBlas.h:46

Here is the call graph for this function:

Here is the caller graph for this function:

void init ( double  t)
virtual

Reimplemented from Action.

Reimplemented in Extrapolate_Central, and Extrapolate_Linear.

Definition at line 43 of file Interpolate.C.

References Action::attr, attr_hdls, bkup_hdls, COM_assertion_msg, COM_call_function(), COM_get_attribute_handle(), COM_get_attribute_handle_const(), RocBlas::copy_scalar, Action::get_attribute_handle(), Action::get_attribute_handle_const(), Action::get_io(), i, MAN_DEBUG, Action::name(), and Action::OUT.

Referenced by Extrapolate_Linear::init(), and Extrapolate_Central::init().

44 {
45  MAN_DEBUG(3, ("%s::init called.\n", name()));
46  // INIT_INTERP_HANDLES() in "man_basic.f90"
49  attr_hdls[2] = COM_get_attribute_handle(attr[2]); // alp
50  attr_hdls[3] = COM_get_attribute_handle(attr[3]); // grad
51  for (int i=0; i<4; i++) {
52  // init to 0
53  if (get_io(i) == OUT) {
54  double zero = 0.0;
56  }
57  }
58  if ( attr_hdls[1] <= 0 && attr_hdls[2] <= 0)
59  std::cout << "Rocstar Warning: Could not find attribute " << attr[2] << std::endl;
60  else if (attr_hdls[2] <= 0) {
61  std::cout << "Rocstar Error: Could not find attribute " << attr[2] << std::endl;
62  COM_assertion_msg(0, "ERROR: Abort!");
63  }
64 
65  // backup handles
67  bkup_hdls[1] = get_attribute_handle(1); // old
68  bkup_hdls[2] = COM_get_attribute_handle(attr[3]); // grad
69 }
virtual char * name()
Definition: Action.h:53
#define COM_assertion_msg(EX, msg)
int get_attribute_handle(int i)
Definition: Action.C:93
int bkup_hdls[3]
Definition: Interpolate.h:45
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
int get_attribute_handle_const(int i)
Definition: Action.C:110
static int copy_scalar
Definition: RocBlas.h:43
char ** attr
Definition: Action.h:37
blockLoc i
Definition: read.cpp:79
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
int COM_get_attribute_handle_const(const char *waname)
Definition: roccom_c++.h:420
int attr_hdls[4]
Definition: Interpolate.h:44
#define MAN_DEBUG(l, x)
Definition: rocman.h:98
int get_io(int i)
Definition: Action.h:74

Here is the call graph for this function:

Here is the caller graph for this function:

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

Member Data Documentation

Agent* bkagent
protected

Definition at line 43 of file Interpolate.h.

Referenced by InterpolateBase().

int bkup_hdls[3]
protected

Definition at line 45 of file Interpolate.h.

Referenced by backup(), init(), and InterpolateBase().

int conditional
protected

Definition at line 46 of file Interpolate.h.

Referenced by Extrapolate_Linear::init(), and Extrapolate_Central::init().

int on
protected

Definition at line 47 of file Interpolate.h.

Referenced by InterpolateBase().


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