MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
AeroMemory Class Referenceabstract

#include <aerodata.h>

Inheritance diagram for AeroMemory:
Collaboration diagram for AeroMemory:

Public Member Functions

 AeroMemory (DriveCaller *pt)
 
virtual ~AeroMemory (void)
 
void Predict (int i, doublereal alpha, doublereal &alf1, doublereal &alf2)
 
void Update (int i)
 
void SetNumPoints (int i)
 
int GetNumPoints (void) const
 

Protected Member Functions

virtual int StorageSize (void) const =0
 

Protected Attributes

DriveCallerpTime
 

Private Attributes

doublereala
 
doublerealt
 
integer iPoints
 
int numUpdates
 

Detailed Description

Definition at line 59 of file aerodata.h.

Constructor & Destructor Documentation

AeroMemory::AeroMemory ( DriveCaller pt)

Definition at line 44 of file aerodata.cc.

References NO_OP.

45 : a(0), t(0), iPoints(0), numUpdates(0), pTime(pt)
46 {
47  NO_OP;
48 }
integer iPoints
Definition: aerodata.h:63
doublereal * a
Definition: aerodata.h:61
#define NO_OP
Definition: myassert.h:74
doublereal * t
Definition: aerodata.h:62
DriveCaller * pTime
Definition: aerodata.h:67
int numUpdates
Definition: aerodata.h:64
AeroMemory::~AeroMemory ( void  )
virtual

Definition at line 50 of file aerodata.cc.

References a, iPoints, pTime, SAFEDELETE, and SAFEDELETEARR.

51 {
52  if (iPoints > 0) {
53  if (pTime) {
55  }
56 
57  if (a) {
59  }
60  }
61 }
integer iPoints
Definition: aerodata.h:63
doublereal * a
Definition: aerodata.h:61
#define SAFEDELETEARR(pnt)
Definition: mynewmem.h:713
DriveCaller * pTime
Definition: aerodata.h:67
#define SAFEDELETE(pnt)
Definition: mynewmem.h:710

Member Function Documentation

int AeroMemory::GetNumPoints ( void  ) const

Definition at line 162 of file aerodata.cc.

References iPoints.

Referenced by TheodorsenAeroData::AssRes().

163 {
164  return iPoints;
165 }
integer iPoints
Definition: aerodata.h:63
void AeroMemory::Predict ( int  i,
doublereal  alpha,
doublereal alf1,
doublereal alf2 
)

Definition at line 65 of file aerodata.cc.

References a, ASSERT, DriveCaller::dGet(), iPoints, numUpdates, order, polcoe(), pTime, StorageSize(), and t.

Referenced by STAHRAeroData::GetForces(), C81AeroData::GetForces(), C81MultipleAeroData::GetForces(), and C81InterpolatedAeroData::GetForces().

66 {
67  /* FIXME: this should be s, but I don't want a malloc here */
68  doublereal coe[3];
69  int s = StorageSize();
70 #ifdef USE_POLCOE
71  /*
72  * FIXME: actually this is not the order of the polynomial,
73  * but the number of coefficients, e.g. a second-order polynomial
74  * has three coefficients :)
75  */
76  integer order = s;
77 #endif /* USE_POLCOE */
78 
79  ASSERT(s > 0);
80  ASSERT(i < iPoints);
81 
82  doublereal *aa = a + s*i;
83  doublereal *tt = t + s*i;
84 
85  aa[s-1] = alpha;
86  tt[s-1] = pTime->dGet();
87 
88  if (numUpdates >= s) {
89 #ifdef USE_POLCOE
90  __FC_DECL__(polcoe)(tt, aa, &order, coe);
91 #else /* !USE_POLCOE */
92  coe[2] = ((aa[2]-aa[0])/(tt[2]-tt[0])
93  - (aa[1]-aa[0])/(tt[1]-tt[0]))/(tt[2]-tt[1]);
94  coe[1] = (aa[1]-aa[0])/(tt[1]-tt[0]) - (tt[1]+tt[0])*coe[2];
95 
96 #if 0 /* not used ... */
97  coe[1] = aa[0] - tt[0]*coe[1] - tt[0]*tt[0]*coe[2];
98 #endif
99 #endif /* !USE_POLCOE */
100 
101 #if 0
102  std::cerr << "aa[0:2]= " << aa[0] << "," << aa[1] << "," << aa[2] << std::endl
103  << "tt[0:2]= " << tt[0] << "," << tt[1] << "," << tt[2] << std::endl
104  << "coe[0:2]=" << coe[0] << "," << coe[1] << "," << coe[2] << std::endl;
105 #endif /* 0 */
106 
107  alf1 = coe[1]+2.*coe[2]*tt[2];
108  alf2 = 2.*coe[2];
109  } else {
110  alf1 = 0.;
111  alf2 = 0.;
112  }
113 }
integer iPoints
Definition: aerodata.h:63
int polcoe(doublereal *x, doublereal *y, integer *n, doublereal *cof)
doublereal * a
Definition: aerodata.h:61
virtual int StorageSize(void) const =0
enum @55 order
doublereal * t
Definition: aerodata.h:62
DriveCaller * pTime
Definition: aerodata.h:67
#define ASSERT(expression)
Definition: colamd.c:977
virtual doublereal dGet(const doublereal &dVar) const =0
int numUpdates
Definition: aerodata.h:64
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void AeroMemory::SetNumPoints ( int  i)

Definition at line 141 of file aerodata.cc.

References a, iPoints, SAFENEWARR, StorageSize(), and t.

Referenced by AeroData::AeroData().

142 {
143  int s = StorageSize();
144 
145  iPoints = i;
146 
147  if (s > 0) {
149  t = a + s*iPoints;
150 
151 #ifdef HAVE_MEMSET
152  memset(a, 0, 2*s*iPoints*sizeof(doublereal));
153 #else /* !HAVE_MEMSET */
154  for (int i = 0; i < 2*s*iPoints; i++) {
155  a[i] = 0.;
156  }
157 #endif /* !HAVE_MEMSET */
158  }
159 }
integer iPoints
Definition: aerodata.h:63
doublereal * a
Definition: aerodata.h:61
virtual int StorageSize(void) const =0
doublereal * t
Definition: aerodata.h:62
#define SAFENEWARR(pnt, item, sz)
Definition: mynewmem.h:701
double doublereal
Definition: colamd.c:52

Here is the call graph for this function:

virtual int AeroMemory::StorageSize ( void  ) const
protectedpure virtual

Implemented in AeroData.

Referenced by Predict(), SetNumPoints(), and Update().

void AeroMemory::Update ( int  i)

Definition at line 116 of file aerodata.cc.

References a, ASSERT, iPoints, numUpdates, StorageSize(), and t.

117 {
118  int s = StorageSize();
119  if (s > 0) {
120  /*
121  * shift back angle of attack and time
122  * for future interpolation
123  */
124  doublereal *aa = a + s*i;
125  doublereal *tt = t + s*i;
126 
127  ASSERT(i < iPoints);
128 
129  for (int j = 1; j < s; j++) {
130  aa[j-1] = aa[j];
131  tt[j-1] = tt[j];
132  }
133 
134  if (i == 0) {
135  numUpdates++;
136  }
137  }
138 }
integer iPoints
Definition: aerodata.h:63
doublereal * a
Definition: aerodata.h:61
virtual int StorageSize(void) const =0
doublereal * t
Definition: aerodata.h:62
#define ASSERT(expression)
Definition: colamd.c:977
int numUpdates
Definition: aerodata.h:64
double doublereal
Definition: colamd.c:52

Here is the call graph for this function:

Member Data Documentation

doublereal* AeroMemory::a
private

Definition at line 61 of file aerodata.h.

Referenced by Predict(), SetNumPoints(), Update(), and ~AeroMemory().

integer AeroMemory::iPoints
private

Definition at line 63 of file aerodata.h.

Referenced by GetNumPoints(), Predict(), SetNumPoints(), Update(), and ~AeroMemory().

int AeroMemory::numUpdates
private

Definition at line 64 of file aerodata.h.

Referenced by Predict(), and Update().

DriveCaller* AeroMemory::pTime
protected
doublereal* AeroMemory::t
private

Definition at line 62 of file aerodata.h.

Referenced by Predict(), SetNumPoints(), and Update().


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