MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
module-template.cc File Reference
#include "mbconfig.h"
#include <iostream>
#include <cfloat>
#include <dataman.h>
#include "loadable.h"
Include dependency graph for module-template.cc:

Go to the source code of this file.

Classes

struct  module_template
 

Functions

static void * read (LoadableElem *pEl, DataManager *pDM, MBDynParser &HP)
 
static unsigned int i_get_num_dof (const LoadableElem *pEl)
 
static DofOrder::Order set_dof (const LoadableElem *, unsigned int i)
 
static void output (const LoadableElem *pEl, OutputHandler &OH)
 
static std::ostream & restart (const LoadableElem *pEl, std::ostream &out)
 
static void work_space_dim (const LoadableElem *pEl, integer *piNumRows, integer *piNumCols)
 
static VariableSubMatrixHandlerass_jac (LoadableElem *pEl, VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
static void ass_mats (LoadableElem *pEl, VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
static SubVectorHandlerass_res (LoadableElem *pEl, SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
static void before_predict (const LoadableElem *pEl, VectorHandler &X, VectorHandler &XP, VectorHandler &XPrev, VectorHandler &XPPrev)
 
static void after_predict (const LoadableElem *pEl, VectorHandler &X, VectorHandler &XP)
 
static void update (LoadableElem *pEl, const VectorHandler &X, const VectorHandler &XP)
 
static void after_convergence (const LoadableElem *, const VectorHandler &, const VectorHandler &)
 
static unsigned int i_get_initial_num_dof (const LoadableElem *pEl)
 
static void initial_work_space_dim (const LoadableElem *pEl, integer *piNumRows, integer *piNumCols)
 
static VariableSubMatrixHandlerinitial_ass_jac (LoadableElem *pEl, VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
 
static SubVectorHandlerinitial_ass_res (LoadableElem *pEl, SubVectorHandler &WorkVec, const VectorHandler &XCurr)
 
static void set_value (const LoadableElem *pEl, DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph)
 
static void set_initial_value (const LoadableElem *pEl, VectorHandler &X)
 
static unsigned int i_get_num_priv_data (const LoadableElem *pEl)
 
static unsigned int i_get_priv_data_idx (const LoadableElem *pEl, const char *s)
 
static doublereal d_get_priv_data (const LoadableElem *pEl, unsigned int i)
 
static void destroy (LoadableElem *pEl)
 
static int i_get_num_connected_nodes (const LoadableElem *pEl)
 
static void get_connected_nodes (const LoadableElem *pEl, std::vector< const Node * > &connectedNodes)
 

Variables

static struct LoadableCalls lc
 
void * calls = &lc
 

Function Documentation

static void after_convergence ( const LoadableElem ,
const VectorHandler ,
const VectorHandler  
)
static

Definition at line 220 of file module-template.cc.

References DEBUGCOUTFNAME.

223 {
224  DEBUGCOUTFNAME("after_convergence");
225 }
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
static void after_predict ( const LoadableElem pEl,
VectorHandler X,
VectorHandler XP 
)
static

Definition at line 200 of file module-template.cc.

References DEBUGCOUTFNAME.

205 {
206  DEBUGCOUTFNAME("after_predict");
207 }
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
static VariableSubMatrixHandler& ass_jac ( LoadableElem pEl,
VariableSubMatrixHandler WorkMat,
doublereal  dCoef,
const VectorHandler XCurr,
const VectorHandler XPrimeCurr 
)
static

Definition at line 104 of file module-template.cc.

References DEBUGCOUTFNAME, LoadableElem::pGetData(), FullSubMatrixHandler::ResizeReset(), VariableSubMatrixHandler::SetFull(), and LoadableElem::WorkSpaceDim().

111 {
112  DEBUGCOUTFNAME("ass_jac");
113  integer iNumRows = 0;
114  integer iNumCols = 0;
115  pEl->WorkSpaceDim(&iNumRows, &iNumCols);
116 
117  FullSubMatrixHandler& WM = WorkMat.SetFull();
118  WM.ResizeReset(iNumRows, iNumCols);
119 
120 #if 0
122 #endif /* 0 */
123 
124  /*
125  * set sub-matrix indices and coefs
126  */
127 
128  return WorkMat;
129 }
void * pGetData(void) const
Definition: loadable.h:310
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
long int integer
Definition: colamd.c:51
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: loadable.cc:528

Here is the call graph for this function:

static void ass_mats ( LoadableElem pEl,
VariableSubMatrixHandler WorkMatA,
VariableSubMatrixHandler WorkMatB,
const VectorHandler XCurr,
const VectorHandler XPrimeCurr 
)
static

Definition at line 132 of file module-template.cc.

References DEBUGCOUTFNAME, LoadableElem::pGetData(), FullSubMatrixHandler::ResizeReset(), VariableSubMatrixHandler::SetFull(), and LoadableElem::WorkSpaceDim().

139 {
140  DEBUGCOUTFNAME("ass_mats");
141  integer iNumRows = 0;
142  integer iNumCols = 0;
143  pEl->WorkSpaceDim(&iNumRows, &iNumCols);
144 
145  FullSubMatrixHandler& WMA = WorkMatA.SetFull();
146  WMA.ResizeReset(iNumRows, iNumCols);
147 
148  FullSubMatrixHandler& WMB = WorkMatB.SetFull();
149  WMB.ResizeReset(iNumRows, iNumCols);
150 
151 #if 0
153 #endif /* 0 */
154 
155  /*
156  * set sub-matrix indices and coefs
157  */
158 }
void * pGetData(void) const
Definition: loadable.h:310
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
long int integer
Definition: colamd.c:51
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: loadable.cc:528

Here is the call graph for this function:

static SubVectorHandler& ass_res ( LoadableElem pEl,
SubVectorHandler WorkVec,
doublereal  dCoef,
const VectorHandler XCurr,
const VectorHandler XPrimeCurr 
)
static

Definition at line 161 of file module-template.cc.

References DEBUGCOUTFNAME, LoadableElem::pGetData(), VectorHandler::Resize(), and LoadableElem::WorkSpaceDim().

168 {
169  DEBUGCOUTFNAME("ass_res");
170  integer iNumRows = 0;
171  integer iNumCols = 0;
172  pEl->WorkSpaceDim(&iNumRows, &iNumCols);
173 
174  WorkVec.Resize(iNumRows);
175 
176 #if 0
177  module_template* p = (module_template *)pEl->pGetData();
178 #endif /* 0 */
179 
180  /*
181  * set sub-vector indices and coefs
182  */
183 
184  return WorkVec;
185 }
void * pGetData(void) const
Definition: loadable.h:310
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
long int integer
Definition: colamd.c:51
virtual void Resize(integer iNewSize)=0
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: loadable.cc:528

Here is the call graph for this function:

static void before_predict ( const LoadableElem pEl,
VectorHandler X,
VectorHandler XP,
VectorHandler XPrev,
VectorHandler XPPrev 
)
static

Definition at line 188 of file module-template.cc.

References DEBUGCOUTFNAME.

195 {
196  DEBUGCOUTFNAME("before_predict");
197 }
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
static doublereal d_get_priv_data ( const LoadableElem pEl,
unsigned int  i 
)
static

Definition at line 330 of file module-template.cc.

References ASSERT, DEBUGCOUTFNAME, WithLabel::GetLabel(), LoadableElem::iGetNumPrivData(), and MBDYN_EXCEPT_ARGS.

331 {
332  DEBUGCOUTFNAME("d_get_priv_data");
333  ASSERT(pEl->iGetNumPrivData() > 0);
334  if (i > pEl->iGetNumPrivData()) {
335  silent_cerr("Module-template Elem(" << pEl->GetLabel() << "): "
336  "illegal private data index " << i << std::endl);
338  }
339 
340  /*
341  * return i-th priv data
342  */
343  return 0.;
344 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
#define ASSERT(expression)
Definition: colamd.c:977
virtual unsigned int iGetNumPrivData(void) const
Definition: loadable.cc:646
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

static void destroy ( LoadableElem pEl)
static

Definition at line 347 of file module-template.cc.

References DEBUGCOUTFNAME, LoadableElem::pGetData(), and SAFEDELETE.

348 {
349  DEBUGCOUTFNAME("destroy");
350 
352 
353  /*
354  * delete private data
355  */
356 
357  SAFEDELETE(p);
358 }
void * pGetData(void) const
Definition: loadable.h:310
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
#define SAFEDELETE(pnt)
Definition: mynewmem.h:710

Here is the call graph for this function:

static void get_connected_nodes ( const LoadableElem pEl,
std::vector< const Node * > &  connectedNodes 
)
static

Definition at line 373 of file module-template.cc.

References DEBUGCOUTFNAME, i_get_num_connected_nodes(), and LoadableElem::pGetData().

375 {
376  DEBUGCOUTFNAME("get_connected_nodes");
377 
378 #if 0
380 #endif /* 0 */
381 
382  /*
383  * set args according to element connections
384  */
385  connectedNodes.resize(i_get_num_connected_nodes(pEl));
386 }
void * pGetData(void) const
Definition: loadable.h:310
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
static int i_get_num_connected_nodes(const LoadableElem *pEl)

Here is the call graph for this function:

static unsigned int i_get_initial_num_dof ( const LoadableElem pEl)
static

Definition at line 228 of file module-template.cc.

References DEBUGCOUTFNAME.

229 {
230  DEBUGCOUTFNAME("i_get_initial_num_dof");
231  return 0;
232 }
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
static int i_get_num_connected_nodes ( const LoadableElem pEl)
static

Definition at line 361 of file module-template.cc.

References DEBUGCOUTFNAME, and LoadableElem::pGetData().

Referenced by get_connected_nodes().

362 {
363  DEBUGCOUTFNAME("i_get_num_connected_nodes");
364 
365 #if 0
367 #endif /* 0 */
368 
369  return 0;
370 }
void * pGetData(void) const
Definition: loadable.h:310
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256

Here is the call graph for this function:

static unsigned int i_get_num_dof ( const LoadableElem pEl)
static

Definition at line 69 of file module-template.cc.

References DEBUGCOUTFNAME.

70 {
71  DEBUGCOUTFNAME("i_get_num_dof");
72  return 0;
73 }
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
static unsigned int i_get_num_priv_data ( const LoadableElem pEl)
static

Definition at line 312 of file module-template.cc.

References DEBUGCOUTFNAME.

313 {
314  DEBUGCOUTFNAME("i_get_num_priv_data");
315  return 0;
316 }
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
static unsigned int i_get_priv_data_idx ( const LoadableElem pEl,
const char *  s 
)
static

Definition at line 319 of file module-template.cc.

References DEBUGCOUTFNAME, WithLabel::GetLabel(), and MBDYN_EXCEPT_ARGS.

320 {
321  DEBUGCOUTFNAME("i_get_priv_data_idx");
322  silent_cerr("Module-template Elem(" << pEl->GetLabel() << "): "
323  "priv data \"" << s << "\" is unknown" << std::endl);
325 
326  return 0;
327 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

static VariableSubMatrixHandler& initial_ass_jac ( LoadableElem pEl,
VariableSubMatrixHandler WorkMat,
const VectorHandler XCurr 
)
static

Definition at line 247 of file module-template.cc.

References DEBUGCOUTFNAME, LoadableElem::InitialWorkSpaceDim(), LoadableElem::pGetData(), FullSubMatrixHandler::ResizeReset(), and VariableSubMatrixHandler::SetFull().

252 {
253  DEBUGCOUTFNAME("initial_ass_jac");
254  integer iNumRows = 0;
255  integer iNumCols = 0;
256  pEl->InitialWorkSpaceDim(&iNumRows, &iNumCols);
257 
258  FullSubMatrixHandler& WM = WorkMat.SetFull();
259  WM.ResizeReset(iNumRows, iNumCols);
260 
261 #if 0
263 #endif /* 0 */
264 
265  /*
266  * set sub-matrix indices and coefs
267  */
268 
269  return WorkMat;
270 }
void * pGetData(void) const
Definition: loadable.h:310
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: loadable.cc:607
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

static SubVectorHandler& initial_ass_res ( LoadableElem pEl,
SubVectorHandler WorkVec,
const VectorHandler XCurr 
)
static

Definition at line 273 of file module-template.cc.

References DEBUGCOUTFNAME, LoadableElem::pGetData(), VectorHandler::Resize(), and LoadableElem::WorkSpaceDim().

278 {
279  DEBUGCOUTFNAME("initial_ass_res");
280  integer iNumRows = 0;
281  integer iNumCols = 0;
282  pEl->WorkSpaceDim(&iNumRows, &iNumCols);
283 
284  WorkVec.Resize(iNumRows);
285 
286 #if 0
287  module_template* p = (module_template *)pEl->pGetData();
288 #endif /* 0 */
289 
290  /*
291  * set sub-vector indices and coefs
292  */
293 
294  return WorkVec;
295 }
void * pGetData(void) const
Definition: loadable.h:310
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
long int integer
Definition: colamd.c:51
virtual void Resize(integer iNewSize)=0
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: loadable.cc:528

Here is the call graph for this function:

static void initial_work_space_dim ( const LoadableElem pEl,
integer piNumRows,
integer piNumCols 
)
static

Definition at line 235 of file module-template.cc.

References DEBUGCOUTFNAME.

240 {
241  DEBUGCOUTFNAME("initial_work_space_dim");
242  *piNumRows = 0;
243  *piNumCols = 0;
244 }
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
static void output ( const LoadableElem pEl,
OutputHandler OH 
)
static

Definition at line 83 of file module-template.cc.

References DEBUGCOUTFNAME.

Referenced by fmu2::GetDirectionalDerivatives(), and ReadStructMappingExtForce().

84 {
85  DEBUGCOUTFNAME("output");
86 }
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
static void* read ( LoadableElem pEl,
DataManager pDM,
MBDynParser HP 
)
static

Definition at line 48 of file module-template.cc.

References DEBUGCOUTFNAME, HighParser::IsKeyWord(), and SAFENEW.

Referenced by JoystickDrive::get_one(), JoystickDrive::init(), and main().

49 {
50  DEBUGCOUTFNAME("read");
51 
52  /*
53  * allocation of user-defined struct
54  */
55  module_template* p = NULL;
57 
58  /*
59  * read data
60  */
61  if (HP.IsKeyWord("help")) {
62  silent_cout("Module template" << std::endl);
63  }
64 
65  return (void *)p;
66 }
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
#define SAFENEW(pnt, item)
Definition: mynewmem.h:695
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910

Here is the call graph for this function:

static std::ostream& restart ( const LoadableElem pEl,
std::ostream &  out 
)
static

Definition at line 89 of file module-template.cc.

References DEBUGCOUTFNAME.

90 {
91  DEBUGCOUTFNAME("restart");
92  return out << "not implemented yet;" << std::endl;
93 }
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
static DofOrder::Order set_dof ( const LoadableElem ,
unsigned int  i 
)
static

Definition at line 76 of file module-template.cc.

References DEBUGCOUTFNAME, and DofOrder::UNKNOWN.

77 {
78  DEBUGCOUTFNAME("set_dof");
79  return DofOrder::UNKNOWN;
80 }
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
static void set_initial_value ( const LoadableElem pEl,
VectorHandler X 
)
static

Definition at line 306 of file module-template.cc.

References DEBUGCOUTFNAME.

307 {
308  DEBUGCOUTFNAME("set_initial_value");
309 }
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
static void set_value ( const LoadableElem pEl,
DataManager pDM,
VectorHandler X,
VectorHandler XP,
SimulationEntity::Hints ph 
)
static

Definition at line 298 of file module-template.cc.

References DEBUGCOUTFNAME.

301 {
302  DEBUGCOUTFNAME("set_value");
303 }
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
static void update ( LoadableElem pEl,
const VectorHandler X,
const VectorHandler XP 
)
static

Definition at line 210 of file module-template.cc.

References DEBUGCOUTFNAME.

215 {
216  DEBUGCOUTFNAME("update");
217 }
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
static void work_space_dim ( const LoadableElem pEl,
integer piNumRows,
integer piNumCols 
)
static

Definition at line 96 of file module-template.cc.

References DEBUGCOUTFNAME.

97 {
98  DEBUGCOUTFNAME("work_space_dim");
99  *piNumRows = 0;
100  *piNumCols = 0;
101 }
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256

Variable Documentation

void* calls = &lc

Definition at line 425 of file module-template.cc.

Referenced by DataManager::SetLoadableElemModule().

struct LoadableCalls lc
static

Definition at line 389 of file module-template.cc.