All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions | Static Public Attributes | Protected Member Functions | Friends
DinverDCCore::TargetList2D Class Reference

A 9-node target. More...

#include <TargetList2D.h>

Inheritance diagram for DinverDCCore::TargetList2D:
QGpCoreTools::XMLClass

List of all members.

Public Member Functions

void addTarget (TargetList *t)
void humanInfo () const
bool isPoissonRatioOk (const GroundParameter *from)
double misfit (int nDimensions, bool &ok)
bool setParamProfiles (Param3DGroundModel *gm, RealSpace &ps)
TargetListtarget (int index) const
int targetCount () const
 TargetList2D ()
 TargetList2D (const TargetList2D &o)
void writeReport (ReportWriter *report) const
virtual const QString & xml_tagName () const
 ~TargetList2D ()

Static Public Attributes

static const QString xmlTargetList2DTag = "TargetList2D"

Protected Member Functions

virtual XMLMember xml_member (XML_MEMBER_ARGS)
virtual void xml_writeChildren (XML_WRITECHILDREN_ARGS) const

Friends

class DCReportBlock

Detailed Description

A 9-node target.

1D target are defined for 9 nodes


Constructor & Destructor Documentation

Description of constructor still missing

References TRACE.

    : XMLClass()
{
  TRACE;
}

Description of constructor still missing

References TRACE.

    : XMLClass()
{
  TRACE;
  qDeleteAll(_targets);
  _targets.clear();
  for(QVector<TargetList *>::const_iterator it=o._targets.begin(); it!=o._targets.end(); it++) {
    _targets.append(new TargetList(**it));
  }
}

Description of destructor still missing

References TRACE.

{
  TRACE;
  qDeleteAll(_targets);
}

Member Function Documentation

References TRACE.

Referenced by TargetMerge::execute().

{
  TRACE;
  _targets.append(t);
}

References QGpCoreTools::flush(), DinverDCCore::TargetList::position(), QGpCoreTools::Point::toString(), QGpCoreTools::tr(), and TRACE.

{
  TRACE;
  App::stream() << tr( "\n---------------------- Positions of targets\n\n" );
  int n=_targets.count();
  for(int i=0; i<n; i++) {
    TargetList * tl=_targets.at(i);
    App::stream() << tl->position().toString() << "\n";
  }
  App::stream() << flush;
}

References DinverDCCore::GroundParameter::groundModel(), DinverDCCore::PoissonCondition::isOk(), and TRACE.

{
  TRACE;
  QHash<const ParamGroundModel *, int>::iterator it=_models.find(from->groundModel());
  ASSERT(it!=_models.end());
  PoissonCondition * pc=_poissonCondition[it.value()];
  if(pc) {
    return pc->isOk(from);
  } else {
    return true;
  }
}
double DinverDCCore::TargetList2D::misfit ( int  nDimensions,
bool &  ok 
)

nDimensions is number of free parameters. This is used only if Akaike misfit is computed.

References QGpCoreWave::Profile::collectDepths(), QGpCoreWave::Profile::depths(), DinverDCCore::ParamProfile::maxRawProfile(), DinverDCCore::ParamProfile::minRawProfile(), DinverDCCore::TargetList::position(), DinverDCCore::ParamProfile::rawProfile(), QGpCoreWave::Profile::resample(), DinverDCCore::TargetList::surfaceMisfit(), DinverDCCore::DCReportBlock::surfaceWaveModel(), TRACE, QGpCoreTools::unique(), and QGpCoreWave::Profile::values().

{
  TRACE;
  double totalMisfit=0;
  double totalWeight=0;
  Seismic1DModel * m=0;
  int n=_targets.count();
  for(int i=0; i<n; i++) {
    TargetList * tl=_targets.at(i);
    Profile vp, nuMin, nuMax, vs, rho, rvp, rnuMin, rnuMax, rvs, rrho;
    // Construction of vp, vs and rho profiles at target position
    interpole(tl->position(), _vp[0]->rawProfile(), _vp[1]->rawProfile(), _vp[2]->rawProfile(), vp);
    interpole(tl->position(), _nu[0]->minRawProfile(), _nu[1]->minRawProfile(), _nu[2]->minRawProfile(), nuMin);
    interpole(tl->position(), _nu[0]->maxRawProfile(), _nu[1]->maxRawProfile(), _nu[2]->maxRawProfile(), nuMax);
    interpole(tl->position(), _vs[0]->rawProfile(), _vs[1]->rawProfile(), _vs[2]->rawProfile(), vs);
    interpole(tl->position(), _rho[0]->rawProfile(), _rho[1]->rawProfile(), _rho[2]->rawProfile(), rho);
    // Merge profile sampling
    QVector<double> depths;
    vp.collectDepths(depths);
    nuMin.collectDepths(depths);
    nuMax.collectDepths(depths);
    vs.collectDepths(depths);
    rho.collectDepths(depths);
    /*QVector<double>::iterator itD;
    for(itD=depths.begin();itD!=depths.end();itD++) {
      printf("Before sort %lg\n",*itD);
    }*/
    qSort(depths);
    unique(depths);
    /*for(itD=depths.begin();itD!=depths.end();itD++) {
      printf("After unique %lg\n",*itD);
    }*/
    rvp.resample(vp, depths);
    rnuMin.resample(nuMin, depths);
    rnuMax.resample(nuMax, depths);
    rvs.resample(vs, depths);
    rrho.resample(rho, depths);
    m=DCReportBlock::surfaceWaveModel(rvp.depths(), rvp.values(), rvs.values(), rrho.values(),
                                        &rnuMin.values(), &rnuMax.values());
    tl->surfaceMisfit(totalMisfit, totalWeight, m, nDimensions, ok);
    delete m;
    if(!ok) return 0.0;
    if(i==0) {
      _reportVp=rvp;
      _reportVs=rvs;
      _reportRho=rrho;
    }
  }
  if(totalWeight > 0) return totalMisfit/totalWeight;
  else return totalMisfit;
}

References DinverCore::RealSpace::addCondition(), DinverDCCore::ParamProfile::Condition, QGpCoreTools::endl(), DinverDCCore::ParamGroundModel::find(), DinverDCCore::Param3DGroundModel::model(), DinverDCCore::Param3DGroundModel::modelCount(), DinverDCCore::ParamProfile::nLayers(), DinverDCCore::ParamGroundModel::position(), QGpCoreTools::Plane::setNormalVector(), QGpCoreTools::Plane::setReference(), QGpCoreTools::tr(), and TRACE.

{
  TRACE;
  ASSERT(gm->modelCount()==3);
  for(int i=0; i<3; i++) {
    ParamGroundModel * m=gm->model(i);
    _vp[i]=m->find( "Vp" );
    _vs[i]=m->find( "Vs" );
    _rho[i]=m->find( "Rho" );
    if(_vp[i] && _vs[i]) {
      _nu[i]=m->find( "Nu" );
      ASSERT(_nu[i] && _nu[i]->type()==ParamProfile::Condition);
      _poissonCondition[i]=new PoissonCondition(_vp[i], _vs[i], _nu[i] );
      ps.addCondition(_poissonCondition[i]);
    }
    _planeEngine.setReference(i, m->position());
    _models.insert(m, i);
  }
  if(!_planeEngine.setNormalVector()) {
    return false;
  }

  // Check if number of layers is the same for all models
  for(int i=1; i<3; i++) {
    if(_vp[i]->nLayers()!=_vp[i-1]->nLayers() ||
       _nu[i]->nLayers()!=_nu[i-1]->nLayers() ||
       _vs[i]->nLayers()!=_vs[i-1]->nLayers() ||
       _rho[i]->nLayers()!=_rho[i-1]->nLayers()) {
      App::stream() << tr("Numer of layers must be the same for all reference models") << endl;
      return false;
    }
  }
  return true;
}
TargetList* DinverDCCore::TargetList2D::target ( int  index) const [inline]
{return _targets.at(index);}
{return _targets.count();}

References TRACE, and DinverDCCore::DCReportBlock::write().

{
  TRACE;
  DCReportBlock::write(report, *_targets[0], &_reportVp, &_reportVs, &_reportRho);
}

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:

  • An integer: id number of a property
  • A XMLClass * : a child of this object identified by tag
  • Default constructor: error, unknow child or property

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.

References TRACE.

{
  TRACE;
  Q_UNUSED(context);
  Q_UNUSED(attributes);
  if(tag=="TargetList" ) {
    _targets.append(new TargetList);
    return XMLMember(_targets.last());
  }
  return XMLMember(XMLMember::Unknown);
}
virtual const QString& DinverDCCore::TargetList2D::xml_tagName ( ) const [inline, virtual]

Reimplemented from QGpCoreTools::XMLClass.

References TRACE.

{
  TRACE;
  for(QVector<TargetList *>::const_iterator it=_targets.begin(); it!=_targets.end(); it++) {
    (*it)->xml_save(s, context);
  }
}

Friends And Related Function Documentation

friend class DCReportBlock [friend]

Member Data Documentation

const QString DinverDCCore::TargetList2D::xmlTargetList2DTag = "TargetList2D" [static]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines