151 std::vector<unsigned int> modeList;
153 const std::vector<unsigned int>& uModeList = pModal->
GetModeList();
154 std::vector<bool> gotIt(pModal->
uGetNModes());
159 int iNumModes = HP.
GetInt();
160 if (iNumModes <= 0 || iNumModes > pModal->
uGetNModes()) {
161 silent_cerr(
"ModalForce(" << uLabel <<
"): "
162 "illegal mode number " << iNumModes
166 modeList.resize(iNumModes);
168 for (
int i = 0; i < iNumModes; i++) {
171 silent_cerr(
"ModalForce(" << uLabel <<
"): "
172 "illegal mode " << iM
178 std::vector<unsigned int>::const_iterator
179 iv = std::find(uModeList.begin(), uModeList.end(), (
unsigned int)iM);
180 if (iv == uModeList.end()) {
181 silent_cerr(
"ModalForce(" << uLabel <<
"): "
182 "mode " << iM <<
" not active "
183 "in Modal(" << pModal->
GetLabel() <<
")"
187 int iModeIdx = iv - uModeList.begin();
189 if (gotIt[iModeIdx]) {
190 silent_cerr(
"ModalForce(" << uLabel <<
"): "
191 "mode " << iModeIdx <<
" already set "
196 modeList[i] = iModeIdx + 1;
197 gotIt[iModeIdx] =
true;
207 std::vector<DriveCaller *> f(modeList.size());
212 Mt =
new Mat3xN(modeList.size(), 0.);
213 Mr =
new Mat3xN(modeList.size(), 0.);
215 for (
unsigned i = 0; i < f.size(); i++) {
218 silent_cerr(
"ModalForce(" << uLabel <<
"): "
219 "unable to read DriveCaller for mode #" << i + 1
220 <<
" (mode number " << modeList[i] <<
") "
225 if (pNode && HP.
IsKeyWord(
"resultant")) {
226 for (
unsigned r = 1; r <= 3; r++) {
227 (*Mt)(r, i + 1) = HP.
GetReal();
230 for (
unsigned r = 1; r <= 3; r++) {
231 (*Mr)(r, i + 1) = HP.
GetReal();
239 ModalForce(uLabel, pModal, modeList, f, Mt, Mr, fOut));
flag fReadOutput(MBDynParser &HP, const T &t) const
const ModalNode * pGetModalNode(void) const
#define MBDYN_EXCEPT_ARGS
virtual integer GetInt(integer iDefval=0)
Elem * ReadElem(MBDynParser &HP, Elem::Type type) const
integer uGetNModes(void) const
virtual bool IsKeyWord(const char *sKeyWord)
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
DriveCaller * GetDriveCaller(bool bDeferred=false)
virtual HighParser::ErrOut GetLineData(void) const
unsigned int GetLabel(void) const
const std::vector< unsigned int > & GetModeList(void) const
virtual doublereal GetReal(const doublereal &dDefval=0.0)