Vector of double to store frequency samples and abstract modal object. More...
#include <CompatModalFrequency.h>
Public Member Functions | |
void | addLoveModes (int nNewModes) |
virtual void | addRayleighModes (int nNewModes)=0 |
CompatModalFrequency () | |
QVector< double > * | frequencies () const |
void | insertOmegas (const CompatModalFrequency &samples) |
bool | isSameOmegas (const CompatModalFrequency &o) const |
int | nLoveModes () const |
virtual int | nModes () const =0 |
int | nOmegas () const |
int | nRayleighModes () const |
double & | omega (int iOmega) |
const double & | omega (int iOmega) const |
void | operator= (CompatModalFrequency &o) |
void | setFrequencies (QVector< double > &values) |
virtual void | setNModes (int nm)=0 |
virtual void | setNOmegas (int nf) |
void | setNRayleighModes (int nRm) |
virtual const QString & | xml_tagName () const |
virtual | ~CompatModalFrequency () |
Static Public Attributes | |
static const QString | xmlModalFrequencyTag = "ModalFrequency" |
Protected Member Functions | |
virtual void | addInvalid ()=0 |
virtual void | insertInvalidAt (int i)=0 |
virtual XMLMember | xml_member (XML_MEMBER_ARGS) |
virtual bool | xml_setProperty (XML_SETPROPERTY_ARGS) |
virtual void | xml_writeProperties (XML_WRITEPROPERTIES_ARGS) const |
Protected Attributes | |
int | _nRayleighModes |
Vector of double to store frequency samples and abstract modal object.
References _nRayleighModes, and TRACE.
{ TRACE; _nRayleighModes=0; }
virtual QGpCompatibility::CompatModalFrequency::~CompatModalFrequency | ( | ) | [inline, virtual] |
{};
virtual void QGpCompatibility::CompatModalFrequency::addInvalid | ( | ) | [protected, pure virtual] |
Implemented in QGpCompatibility::CompatModalRefinedCurves.
Referenced by insertOmegas().
void QGpCompatibility::CompatModalFrequency::addLoveModes | ( | int | nNewModes | ) |
QGpCompatibility::CompatModalFrequency::addRayleighModes | ( | int | nNewModes | ) | [pure virtual] |
if there are Love modes, the task is a bit more complex...
Implemented in QGpCompatibility::CompatModalRefinedCurves.
QVector< double > * QGpCompatibility::CompatModalFrequency::frequencies | ( | ) | const |
References nOmegas(), and omega().
{ QVector<double> * list=new QVector<double>; list->reserve(nOmegas()); double fac=0.5/M_PI; for(int i=0;i<nOmegas();i++) list->push_back(omega(i)*fac); return list; }
virtual void QGpCompatibility::CompatModalFrequency::insertInvalidAt | ( | int | i | ) | [protected, pure virtual] |
Implemented in QGpCompatibility::CompatModalRefinedCurves.
Referenced by insertOmegas().
void QGpCompatibility::CompatModalFrequency::insertOmegas | ( | const CompatModalFrequency & | o | ) |
Make sure that all samples of samples are included in this sample set. If a sample already exists nothing is performed. If not, an invalid sample is added.
References addInvalid(), insertInvalidAt(), nOmegas(), omega(), and TRACE.
{ TRACE; int nf2Add=o.nOmegas(); int i=0; for(int i2Add=0;i2Add<nf2Add;i2Add++) { double f2Add=o.omega(i2Add); while(i<nOmegas() && omega(i)<f2Add) i++; if(i>=nOmegas()) { append(f2Add); addInvalid(); } else if(omega(i)>f2Add) { insert(i,f2Add); insertInvalidAt(i); i++; } } }
bool QGpCompatibility::CompatModalFrequency::isSameOmegas | ( | const CompatModalFrequency & | o | ) | const |
int QGpCompatibility::CompatModalFrequency::nLoveModes | ( | ) | const [inline] |
{return nModes()-_nRayleighModes;}
virtual int QGpCompatibility::CompatModalFrequency::nModes | ( | ) | const [pure virtual] |
Implemented in QGpCompatibility::CompatModalRefinedCurves.
Referenced by addLoveModes().
int QGpCompatibility::CompatModalFrequency::nOmegas | ( | ) | const [inline] |
Referenced by frequencies(), insertOmegas(), isSameOmegas(), QGpCompatibility::CompatModalEllipticity::oldStyle(), QGpCompatibility::CompatModalDispersion::oldStyle(), QGpCompatibility::operator<<(), setFrequencies(), QGpCompatibility::CompatModalRefinedCurves::toPointVector(), QGpCompatibility::CompatModalRefinedCurves::toStream(), and QGpCompatibility::CompatModalRefinedCurves::writeReport().
{return count();}
int QGpCompatibility::CompatModalFrequency::nRayleighModes | ( | ) | const [inline] |
double& QGpCompatibility::CompatModalFrequency::omega | ( | int | iOmega | ) | [inline] |
Referenced by frequencies(), insertOmegas(), isSameOmegas(), QGpCompatibility::CompatModalEllipticity::oldStyle(), QGpCompatibility::CompatModalDispersion::oldStyle(), QGpCompatibility::operator<<(), QGpCompatibility::operator>>(), setFrequencies(), QGpCompatibility::CompatModalRefinedCurves::toPointVector(), QGpCompatibility::CompatModalRefinedCurves::toStream(), QGpCompatibility::CompatModalRefinedCurves::writeReport(), and DinverDCCore::TargetList::xml_polishChild().
{return operator[] (iOmega);}
const double& QGpCompatibility::CompatModalFrequency::omega | ( | int | iOmega | ) | const [inline] |
{return operator[] (iOmega);}
void QGpCompatibility::CompatModalFrequency::operator= | ( | CompatModalFrequency & | o | ) |
References _nRayleighModes, and TRACE.
{ TRACE; QVector<double>::operator=(o); _nRayleighModes=o._nRayleighModes; }
void QGpCompatibility::CompatModalFrequency::setFrequencies | ( | QVector< double > & | values | ) |
References QGpCoreTools::endl(), nOmegas(), omega(), QGpCoreTools::tr(), and TRACE.
virtual void QGpCompatibility::CompatModalFrequency::setNModes | ( | int | nm | ) | [pure virtual] |
Implemented in QGpCompatibility::CompatModalEllipticity, and QGpCompatibility::CompatModalRefinedCurves.
Referenced by addLoveModes().
virtual void QGpCompatibility::CompatModalFrequency::setNOmegas | ( | int | nf | ) | [inline, virtual] |
Reimplemented in QGpCompatibility::CompatModalRefinedCurves.
Referenced by QGpCompatibility::operator>>().
{resize(nf);}
void QGpCompatibility::CompatModalFrequency::setNRayleighModes | ( | int | nRm | ) | [inline] |
Referenced by QGpCompatibility::CompatModalRefinedCurves::addRayleighModes(), and QGpCompatibility::operator>>().
{_nRayleighModes=nRm;}
XMLMember QGpCompatibility::CompatModalFrequency::xml_member | ( | XML_MEMBER_ARGS | ) | [protected, virtual] |
Re-implement this function to offer XML restore (children and properties) support to your class.
From tag and map (with contains the attibute value) return a unique identifier under the format of a XMLMember. XMLMember is initialized with 3 types of contructors:
Map of attributes can be inspected in this way (can be achived also in xml_setProperty()):
static const QString tmp("childrenName"); XMLRestoreAttributeIterator it=map.find(tmp); if(it!=map.end()) { // found attribute "childrenName" }
If the map of attributes is not used:
Q_UNUSED(attributes); if(tag=="x1") return XMLMember(0); else if(tag=="y1") return XMLMember(1); else if(tag=="x2") return XMLMember(2); else if(tag=="y2") return XMLMember(3); else return XMLMember(XMLMember::Unknown);
Arithmetic operations + and - apply to XMLMember to avoid confusion of property id numbers between inherited objects. Offset 3 corresponds to the number of properties defined in this object.
if(tag=="anInteger") return XMLMember(0); else if(tag=="aString") return XMLMember(1); else if(tag=="aDouble") return XMLMember(2); return AbstractLine::xml_member(tag, attributes, context)+3;
For the arguments of this function use Macro XML_MEMBER_ARGS.
Reimplemented from QGpCoreTools::XMLClass.
Reimplemented in QGpCompatibility::CompatModalRefinedCurves, and QGpCompatibility::CompatModalEllipticity.
References QGpCoreTools::tr(), and TRACE.
{ TRACE; Q_UNUSED(attributes) Q_UNUSED(context); if(tag=="values") return XMLMember(0); else if(tag=="val") return XMLMember(1); else if(tag=="DoubleVector") { App::stream() << tr("## WARNING ## : old style for list of frequencies, replace\n" "<DoubleVector>\n" " <val>f1</val>\n" " <val>f2</val>\n" " ...\n" " </DoubleVector>\n" "by\n" "<val>f1</val>\n" "<val>f2</val>\n" " ...\n"); return XMLMember(XMLMember::Unknown); } else if(tag=="nRayleighModes") return XMLMember(2); else return XMLMember(XMLMember::Unknown); }
bool QGpCompatibility::CompatModalFrequency::xml_setProperty | ( | XML_SETPROPERTY_ARGS | ) | [protected, virtual] |
Re-implement this function to offer XML restore properties support to your class.
From memberID set the corresponding property with value content. The map of attributes is given as a supplementary information (not useful in all cases).
For a general case:
Q_UNUSED(attributes); double val=content.toDouble(); switch (memberID) { case 0: _x1=val; return true; case 1: _y1=val; return true; case 2: _x2=val; return true; case 3: _y2=val; return true; default: return false; }
For classes inheriting other classes (see also xml_member())
switch (memberID) { case 0: _anInteger=content.toString(); return true; case 1: _aString=content.toInt(); return true; case 2: _aDouble=content.toDouble(); return true; default: return AbstractLine::xml_setProperty(memberID-3, map, content);
For the arguments of this function use Macro XML_SETPROPERTY_ARGS.
Reimplemented from QGpCoreTools::XMLClass.
Reimplemented in QGpCompatibility::CompatModalEllipticity.
References _nRayleighModes, QGpCoreTools::StringSection::isValid(), QGpCoreTools::StringSection::nextField(), QGpCoreTools::StringSection::toDouble(), and TRACE.
{ TRACE; Q_UNUSED(tag); Q_UNUSED(attributes) Q_UNUSED(context); switch (memberID) { case 0: { const QChar * ptr=0; static const QString sep=" \n\t\r"; StringSection f; clear(); while(true) { f=content.nextField(ptr, sep, true); if(f.isValid()) append(f.toDouble()); else break; } } return true; case 1: append(content.toDouble()); return true; case 2: _nRayleighModes=content.toInt(); return true; default: return false; } }
virtual const QString& QGpCompatibility::CompatModalFrequency::xml_tagName | ( | ) | const [inline, virtual] |
Implements QGpCoreTools::XMLClass.
Reimplemented in QGpCompatibility::CompatModalRefinedCurves, QGpCompatibility::CompatModalEllipticity, and QGpCompatibility::CompatModalDispersion.
{return xmlModalFrequencyTag;}
void QGpCompatibility::CompatModalFrequency::xml_writeProperties | ( | XML_WRITEPROPERTIES_ARGS | ) | const [protected, virtual] |
Reimplemented from QGpCoreTools::XMLClass.
Reimplemented in QGpCompatibility::CompatModalEllipticity.
References _nRayleighModes, QGpCoreTools::endl(), TRACE, and QGpCoreTools::XMLClass::writeProperty().
{ TRACE; Q_UNUSED(context); writeProperty(s, "nRayleighModes",_nRayleighModes); QString tmp; tmp+=s.indent(); tmp+="<values>\n"; int n=count(); for(int i=0;i<n;i++) { tmp+=s.indent(); tmp+=" "; tmp+=QString::number(at(i)); tmp+="\n"; } tmp+=s.indent(); tmp+="</values>"; s << tmp << endl; }
int QGpCompatibility::CompatModalFrequency::_nRayleighModes [protected] |
Referenced by CompatModalFrequency(), operator=(), xml_setProperty(), and xml_writeProperties().
const QString QGpCompatibility::CompatModalFrequency::xmlModalFrequencyTag = "ModalFrequency" [static] |