MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
therm.cc File Reference
#include "mbconfig.h"
#include "mynewmem.h"
#include "therm.h"
#include "thermalnode.h"
#include "thermalcapacitance.h"
#include "thermalresistance.h"
#include "thermalsource.h"
#include "dataman.h"
Include dependency graph for therm.cc:

Go to the source code of this file.

Functions

ElemReadThermal (DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
 

Function Documentation

Elem* ReadThermal ( DataManager pDM,
MBDynParser HP,
const DofOwner pDO,
unsigned int  uLabel 
)

Definition at line 82 of file therm.cc.

References c, DEBUGCOUTFNAME, Elem::ELECTRIC, DataManager::fReadOutput(), MBDynParser::GetDriveCaller(), WithLabel::GetLabel(), IncludeParser::GetLineData(), DataManager::GetLogFile(), HighParser::GetReal(), HighParser::GetWord(), HighParser::IsArg(), LASTKEYWORD, MBDYN_EXCEPT_ARGS, DataManager::ReadNode(), SAFENEWWITHCONSTRUCTOR, and Node::THERMAL.

Referenced by DataManager::ReadOneElem().

86 {
87  DEBUGCOUTFNAME("ReadEThermal()");
88 
89  const char* sKeyWords[] = {
90  "resistance",
91  "capacitance",
92  "source"
93  };
94 
95  /* enum delle parole chiave */
96  enum KeyWords {
97  UNKNOWN = -1,
98 
99  THERMALRESISTANCE = 0,
100  THERMALCAPACITANCE,
101  THERMALSOURCE,
102 
104  };
105 
106  /* tabella delle parole chiave */
107  KeyTable K(HP, sKeyWords);
108 
109  /* lettura del tipo di elemento elettrico */
110  KeyWords CurrKeyWord = KeyWords(HP.GetWord());
111 
112 #ifdef DEBUG
113  if (CurrKeyWord >= 0) {
114  std::cout << "thermal element type: "
115  << sKeyWords[CurrKeyWord] << std::endl;
116  }
117 #endif
118 
119  Elem* pEl = 0;
120 
121  switch (CurrKeyWord) {
122  /* */
123 
124  case THERMALRESISTANCE: {
125  const ThermalNode* pThNode1 = pDM->ReadNode<const ThermalNode, Node::THERMAL>(HP);
126  const ThermalNode* pThNode2 = pDM->ReadNode<const ThermalNode, Node::THERMAL>(HP);
127  doublereal r = HP.GetReal();
128  flag fOut = pDM->fReadOutput(HP, Elem::ELECTRIC);
131  ThermalResistance(uLabel, pDO,
132  pThNode1, pThNode2,
133  r, fOut));
134 
135  std::ostream& out = pDM->GetLogFile();
136  out << "thermal resistance: " << uLabel
137  << " " << pThNode1->GetLabel()
138  << " " << pThNode2->GetLabel()
139  << std::endl;
140  break;
141  }
142 
143  case THERMALCAPACITANCE: {
144  const ThermalNode* pThNode1 = pDM->ReadNode<const ThermalNode, Node::THERMAL>(HP);
145  doublereal c = HP.GetReal();
146  flag fOut = pDM->fReadOutput(HP, Elem::ELECTRIC);
149  ThermalCapacitance(uLabel, pDO, pThNode1, c, fOut));
150 
151  std::ostream& out = pDM->GetLogFile();
152  out << "thermal capacitance: " << uLabel
153  << " " << pThNode1->GetLabel()
154  << std::endl;
155  break;
156  }
157 
158  case THERMALSOURCE: {
159  const ThermalNode* pThNode1 = pDM->ReadNode<const ThermalNode, Node::THERMAL>(HP);
160  DriveCaller* pDC = HP.GetDriveCaller();
161  flag fOut = pDM->fReadOutput(HP, Elem::ELECTRIC);
164  ThermalSource(uLabel, pDO, pThNode1, pDC, fOut));
165 
166  std::ostream& out = pDM->GetLogFile();
167  out << "thermal source: " << uLabel
168  << " " << pThNode1->GetLabel()
169  << std::endl;
170  break;
171  }
172 
173  /* Aggiungere altri elementi elettrici */
174 
175  default: {
176  silent_cerr("unknown thermal element type in thermal element " << uLabel
177  << " at line " << HP.GetLineData() << std::endl);
179  }
180  }
181 
182  /* Se non c'e' il punto e virgola finale */
183  if (HP.IsArg()) {
184  silent_cerr("semicolon expected at line " << HP.GetLineData() << std::endl);
186  }
187 
188  return pEl;
189 } /* ReadThermal() */
flag fReadOutput(MBDynParser &HP, const T &t) const
Definition: dataman.h:1064
long int flag
Definition: mbdyn.h:43
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
KeyWords
Definition: dataman4.cc:94
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
static std::stack< cleanup * > c
Definition: cleanup.cc:59
virtual bool IsArg(void)
Definition: parser.cc:807
Definition: elem.h:75
virtual int GetWord(void)
Definition: parser.cc:1083
std::ostream & GetLogFile(void) const
Definition: dataman.h:326
DriveCaller * GetDriveCaller(bool bDeferred=false)
Definition: mbpar.cc:2033
double doublereal
Definition: colamd.c:52
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
unsigned int GetLabel(void) const
Definition: withlab.cc:62
Node * ReadNode(MBDynParser &HP, Node::Type type) const
Definition: dataman3.cc:2309
virtual doublereal GetReal(const doublereal &dDefval=0.0)
Definition: parser.cc:1056

Here is the call graph for this function: