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

Brief description of class still missing. More...

#include <ParamLayer.h>

Inheritance diagram for DinverDCCore::ParamLayer:
QGpCoreTools::XMLClass

List of all members.

Public Types

enum  Shape {
  Uniform, Linear, LinearIncrease, LinearDecrease,
  PowerLaw
}

Public Member Functions

double bottomDepth () const
double bottomMaximumValue () const
double bottomMinimumValue () const
ParameterbottomParam () const
void collectValueParameters (QList< Parameter * > &params) const
bool depthToParam (bool last, ParamLayer *prev, RealSpace &ps, const ParamGroundModel *groundModel)
ParameterdhParam () const
double fixedBottomDepth () const
int index () const
bool isDepth () const
bool isLastParamCondition () const
bool isLinkedTo (ParamLayer *o)
bool isUniformShape ()
const QString & linkedTo () const
double maximumDepth () const
double minimumDepth () const
QString name () const
int nSubLayers () const
 ParamLayer (const ParamLayer &o)
 ParamLayer (ParamProfile *profile, int index)
 ParamLayer (ParamProfile *profile, int index, double minValue, double maxValue, ParamProfile *linkedTo)
 ParamLayer (ParamProfile *profile, int index, double minValue, double maxValue, double minDepth, double maxDepth)
ParamProfileprofile () const
void setBottomMaximumValue (double v)
void setBottomMinimumValue (double v)
void setDepth (bool d)
void setFinalDepths (double &z)
void setFinalProfileDepthsCondition (Profile &min, Profile &max, double &z)
void setFinalProfileDepthsParam (Profile &profile, double &z)
void setFinalProfileValuesCondition (Profile &min, Profile &max)
void setFinalProfileValuesParam (Profile &profile)
void setIndex (int i)
void setLastParamCondition (bool c)
void setLinkedDepth (bool last, ParamLayer *prev, RealSpace &ps)
void setLinkedTo (const QString &l)
void setLinkedTo ()
void setMaximumDepth (double v)
void setMinimumDepth (double v)
void setNSubLayers (int n)
void setProfile (ParamProfile *p)
void setPtrLink (ParamLayer *layer)
void setShape (Shape s)
void setTopDepthIndex (int &index)
void setTopMaximumValue (double v)
void setTopMinimumValue (double v)
Shape shape () const
double topDepth () const
int topDepthIndex () const
double topMaximumValue () const
double topMinimumValue () const
ParametertopParam () const
QString unit () const
bool valueToParam (RealSpace &ps, const ParamGroundModel *groundModel)
virtual const QString & xml_tagName () const

Static Public Member Functions

static QString name (QString profileShortName, int index)

Static Public Attributes

static const QString xmlParamLayerTag = "ParamLayer"

Protected Member Functions

double fixedThickness (ParamLayer *&ref)
void setFinalProfileValues (Profile &profile, double topV, double bottomV)
virtual XMLMember xml_member (XML_MEMBER_ARGS)
virtual bool xml_setProperty (XML_SETPROPERTY_ARGS)
virtual void xml_writeProperties (XML_WRITEPROPERTIES_ARGS) const

Protected Attributes

double _bottomMax
double _bottomMin
Parameter_bottomP
double _dhMax
double _dhMin
Parameter_dhP
double _finalBottomDepth
double _finalTopDepth
int _index
bool _isDepth
bool _lastParamCondition
QString _linkedTo
int _nSubLayers
ParamProfile_profile
ParamLayer_ptrLink
Shape _shape
int _topDepthIndex
double _topMax
double _topMin
Parameter_topP

Detailed Description

Brief description of class still missing.

Full description of class still missing


Member Enumeration Documentation

Enumerator:
Uniform 
Linear 
LinearIncrease 
LinearDecrease 
PowerLaw 

Constructor & Destructor Documentation

Copy constructor. Profile ownership is left free. Used only by copy constructor of ParamProfile.

References _bottomMax, _bottomMin, _bottomP, _dhMax, _dhMin, _dhP, _finalBottomDepth, _finalTopDepth, _index, _isDepth, _lastParamCondition, _linkedTo, _nSubLayers, _profile, _ptrLink, _shape, _topDepthIndex, _topMax, _topMin, and _topP.

  : XMLClass()
{
  _profile=0;
  _index=o._index;
  _shape=o._shape;
  _nSubLayers=o._nSubLayers;
  _topMin=o._topMin;
  _topMax=o._topMax;
  _bottomMin=o._bottomMin;
  _bottomMax=o._bottomMax;
  _lastParamCondition=o._lastParamCondition;

  _linkedTo=o._linkedTo;
  _isDepth=o._isDepth;
  _dhMin=o._dhMin;
  _dhMax=o._dhMax;

  _topDepthIndex=o._topDepthIndex;
  _finalTopDepth=o._finalTopDepth;
  _finalBottomDepth=o._finalBottomDepth;

  _ptrLink=0;
  _topP=0;
  _bottomP=0;
  _dhP=0;
}
DinverDCCore::ParamLayer::ParamLayer ( ParamProfile profile,
int  index 
)
DinverDCCore::ParamLayer::ParamLayer ( ParamProfile profile,
int  index,
double  minValue,
double  maxValue,
ParamProfile linkedTo 
)

Create a new layer with a uniform value between minValue and maxValue. The detph is linked to profile linkedTo. Basically used to build a ground model from a Seismic1DModel.

References _bottomMax, _bottomMin, _bottomP, _dhMax, _dhMin, _dhP, _index, _isDepth, _lastParamCondition, _linkedTo, _nSubLayers, _profile, _ptrLink, _shape, _topDepthIndex, _topMax, _topMin, _topP, index(), name(), profile(), DinverDCCore::ParamProfile::shortName(), TRACE, and Uniform.

{
  TRACE;
  _profile=profile;
  _index=index;
  _ptrLink=0;
  _topP=0;
  _bottomP=0;
  _dhP=0;
  _topDepthIndex=0;

  _shape=Uniform;
  _lastParamCondition=false;
  _nSubLayers=1;
  _topMin=minValue;
  _topMax=maxValue;
  _bottomMin=minValue;
  _bottomMax=maxValue;
  _linkedTo=name(linkedTo->shortName(), index);
  _isDepth=true;
  _dhMin=0.0;
  _dhMax=0.0;
}
DinverDCCore::ParamLayer::ParamLayer ( ParamProfile profile,
int  index,
double  minValue,
double  maxValue,
double  minDepth,
double  maxDepth 
)

Create a new layer with a uniform value betweem minValue and maxValue. The detph can vary from minDepth to maxDepth. Basically used to build a ground model from a Seismic1DModel.

References _bottomMax, _bottomMin, _bottomP, _dhMax, _dhMin, _dhP, _index, _isDepth, _lastParamCondition, _linkedTo, _nSubLayers, _profile, _ptrLink, _shape, _topDepthIndex, _topMax, _topMin, _topP, index(), profile(), TRACE, and Uniform.

{
  TRACE;
  _profile=profile;
  _index=index;
  _ptrLink=0;
  _topP=0;
  _bottomP=0;
  _dhP=0;
  _topDepthIndex=0;

  _shape=Uniform;
  _lastParamCondition=false;
  _nSubLayers=1;
  _topMin=minValue;
  _topMax=maxValue;
  _bottomMin=minValue;
  _bottomMax=maxValue;
  _linkedTo="Not linked";
  _isDepth=true;
  _dhMin=minDepth;
  _dhMax=maxDepth;
}

Member Function Documentation

Returns the current depth of the bottom

Referenced by fixedBottomDepth(), and DinverDCCore::PoissonCondition::getLimits().

Referenced by ParamLayerWidget::setFrom().

{return _bottomMax;}
void DinverDCCore::ParamLayer::collectValueParameters ( QList< Parameter * > &  params) const

Add top and bottom parameters if they are not fixed to params.

References _bottomP, _topP, DinverCore::Parameter::isFixed(), and TRACE.

Referenced by DinverDCCore::ParamProfile::collectValueParameters().

{
  TRACE;
  if(_topP) {
    if(!_topP->isFixed()) params.append(_topP);
    if(_bottomP!=_topP) {
      if(!_bottomP->isFixed()) params.append(_bottomP);
    }
  }
}
bool DinverDCCore::ParamLayer::depthToParam ( bool  last,
ParamLayer prev,
RealSpace ps,
const ParamGroundModel groundModel 
)

References _dhMax, _dhMin, _dhP, _isDepth, _ptrLink, DinverCore::RealSpace::addCondition(), DinverCore::RealSpace::addParameter(), DinverDCCore::GroundParameter::Depth, dhParam(), DinverCore::Parameter::initGrid(), isDepth(), DinverCore::Parameter::setFussy(), DinverCore::Parameter::setPrecision(), DinverCore::Parameter::setScale(), DinverDCCore::GroundParameter::Thickness, and TRACE.

Referenced by DinverDCCore::ParamProfile::toParam().

{
  TRACE;
  if(!_ptrLink && !last) {
    _dhP=ps.addParameter(new GroundParameter(groundModel,  this,
                         _isDepth ? GroundParameter::Depth : GroundParameter::Thickness, _dhMin, _dhMax) );
    _dhP->setScale(ParameterGrid::Log);
    _dhP->setPrecision(0.01);
    if(!_dhP->initGrid()) {
      return false;
    }
    _dhP->setFussy(true);
    if (_isDepth && prev && prev->isDepth() && prev->dhParam()) {
      // Strict condition to avoid null thicknesses
      //ps.addCondition(new SimpleCondition (_dhP, SimpleCondition::GreaterThan, 1.0, prev->dhParam(), 0.0 ));
      // Condition to avoid thin layers: thickness cannot be less than 5% of average depth of layer
      ps.addCondition(new SimpleCondition (_dhP, SimpleCondition::GreaterThan, (2.0+0.05)/(2.0-0.05), prev->dhParam(), 0.0));
    }
  } else {
    _dhP=0;
  }
  return true;
}

Referenced by depthToParam().

{return _dhP;}

Returns the current depth of next fixed depth. If the next layers have thickness parameters rather than depth, then the returned value is the bottom of the layer with a depth parameter below these thickness parameter layers, or 1e99 if the half space is reached. If the next layer has a depth parameter, the returned value is the same as bottomDepth().

References _index, bottomDepth(), isDepth(), DinverDCCore::ParamProfile::layer(), DinverDCCore::ParamProfile::nLayers(), profile(), and TRACE.

Referenced by DinverDCCore::PoissonCondition::isOk().

{
  TRACE;
  int nLayers=profile()->nLayers();
  for(int i=_index+1; i<nLayers; i++) {
    ParamLayer * layer=profile()->layer(i);
    if(layer->isDepth()) {
      return layer->bottomDepth();
    }
  }
  return 1e99; // No fixed bottom depth, half space reached
}
double DinverDCCore::ParamLayer::fixedThickness ( ParamLayer *&  ref) [protected]

Return the fixed thickness to the upper most layers with variable depth or thickness returned in ref (left)

References _dhMax, _dhMin, _index, _isDepth, _profile, fixedThickness(), DinverDCCore::ParamProfile::layer(), and TRACE.

Referenced by fixedThickness(), and isLinkedTo().

{
  TRACE;
  if(_dhMin==_dhMax) {
    if(_isDepth || _index==0) {
      ref=0;
      return _dhMin;
    } else {
      return _dhMin+_profile->layer(_index-1)->fixedThickness(ref);
    }
  }
  ref=this;
  return 0.0;
}
int DinverDCCore::ParamLayer::index ( ) const [inline]
bool DinverDCCore::ParamLayer::isDepth ( ) const [inline]

Check if the two layers have a common interface, even through fixed depths and thicknesses

References _ptrLink, fixedThickness(), isLinkedTo(), and TRACE.

Referenced by isLinkedTo().

{
  TRACE;
  // layers are linked together (this towards o)
  if(_ptrLink==o) return true;
  // layers are both linked to another layer (chained links have already been solved)
  if(_ptrLink==o->_ptrLink && _ptrLink!=0) return true;
  // layers are linked together (o towards this)
  if(this==o->_ptrLink) return true;
  // layers have fixed depths or thicknesses
  ParamLayer * lThis, *lo;
  double thickness=fixedThickness(lThis);
  if(thickness==o->fixedThickness(lo) && thickness>0.0) {
    if(lThis && lo) {
      if(!lThis->isLinkedTo(lo)) return false;
    } else if( !lThis && !lo);
    else return false;
  } else return false;
  return true;
}
{return _shape==Uniform;}
const QString& DinverDCCore::ParamLayer::linkedTo ( ) const [inline]
double DinverDCCore::ParamLayer::maximumDepth ( ) const [inline]

Referenced by ParamLayerWidget::setFrom().

{return _dhMax;}
double DinverDCCore::ParamLayer::minimumDepth ( ) const [inline]
QString DinverDCCore::ParamLayer::name ( ) const
QString DinverDCCore::ParamLayer::name ( QString  profileShortName,
int  index 
) [inline, static]

References TRACE.

{
  TRACE;
  return profileShortName+QString::number(index);
}
int DinverDCCore::ParamLayer::nSubLayers ( ) const [inline]

Referenced by ParamLayerWidget::setFrom().

{return _nSubLayers;}
void DinverDCCore::ParamLayer::setDepth ( bool  d) [inline]

Called routinely during inversion, it inits the final bottom depth of the layer.

If the top of the layer is below the bottom, a quasi null thickness is set. This may happen only during initialization phase. At any other time, the conditions on depths must effectively forbid this situation.

Links are not taken into account.

References _dhP, _finalBottomDepth, _finalTopDepth, _isDepth, QGpCoreTools::endl(), name(), DinverCore::Parameter::realValue(), QGpCoreTools::tr(), and TRACE.

{
  TRACE;
  if(_dhP) {
    _finalTopDepth=z;
    if(_isDepth) {
      _finalBottomDepth=_dhP->realValue();
      if(_finalTopDepth >= _finalBottomDepth) {
        App::stream() << tr("Null or negative thickness for layer %1: top=%2, bottom=%3, very thin layer instead (1 mm).")
                     .arg(name()).arg(_finalTopDepth).arg(_finalBottomDepth) << endl;
        _finalBottomDepth=_finalTopDepth + 0.001;
      }
      z=_finalBottomDepth;
    } else {
      _finalBottomDepth=z + _dhP->realValue();
      z=_finalBottomDepth;
    }
  }
}

Called routinely during inversion, it sets the depths of final profiles min and max for condition layers

References _dhP, _finalBottomDepth, _finalTopDepth, _nSubLayers, _ptrLink, _shape, _topDepthIndex, Linear, LinearDecrease, LinearIncrease, PowerLaw, QGpCoreWave::Profile::setDepth(), TRACE, and Uniform.

{
  TRACE;
  if( !_dhP) { // Set final depth for halfspace or layers linked to thickness param
    _finalTopDepth=z;
    if(_ptrLink) _finalBottomDepth=_ptrLink->_finalBottomDepth;
    else _finalBottomDepth=1e99;
  }
  z=_finalBottomDepth;

  switch (_shape) {
  case Uniform:
    min.setDepth(_topDepthIndex, _finalBottomDepth);
    max.setDepth(_topDepthIndex, _finalBottomDepth);
    break;
  case Linear:
  case LinearIncrease:
  case LinearDecrease: {
      double dz=(_finalBottomDepth - _finalTopDepth)/(double) _nSubLayers;
      int n=_nSubLayers-1;
      for(int i=0;i < n;i++ ) {
        int di=_topDepthIndex+i;
        double z=_finalTopDepth + (double) (i + 1) * dz;
        min.setDepth(di, z);
        max.setDepth(di, z);
      }
      min.setDepth(_topDepthIndex+n, _finalBottomDepth);
      max.setDepth(_topDepthIndex+n, _finalBottomDepth);
    }
    break;
  case PowerLaw: {
      double dz=(_finalBottomDepth - _finalTopDepth)/(pow( 2.0, _nSubLayers) - 1.0);
      double z=_finalTopDepth;
      int n=_nSubLayers-1;
      for(int i=0;i < n;i++ ) {
        int di=_topDepthIndex+i;
        z += dz;
        min.setDepth(di, z);
        max.setDepth(di, z);
        dz *= 2.0;
      }
      min.setDepth(_topDepthIndex+n, _finalBottomDepth);
      max.setDepth(_topDepthIndex+n, _finalBottomDepth);
    }
    break;
  }
}
void DinverDCCore::ParamLayer::setFinalProfileDepthsParam ( Profile profile,
double &  z 
)

Called routinely during inversion, it sets the depths of final profile for parameter layers

References _dhP, _finalBottomDepth, _finalTopDepth, _nSubLayers, _ptrLink, _shape, _topDepthIndex, Linear, LinearDecrease, LinearIncrease, PowerLaw, QGpCoreWave::Profile::setDepth(), TRACE, and Uniform.

{
  TRACE;
  if( !_dhP) { // Set final depth for halfspace or layers linked to thickness param
    _finalTopDepth=z;
    if(_ptrLink) _finalBottomDepth=_ptrLink->_finalBottomDepth;
    else _finalBottomDepth=1e99;
  }
  z=_finalBottomDepth;

  switch (_shape) {
  case Uniform:
    profile.setDepth(_topDepthIndex, _finalBottomDepth);
    break;
  case Linear:
  case LinearIncrease:
  case LinearDecrease: {
      double dz=(_finalBottomDepth - _finalTopDepth)/(double) _nSubLayers;
      int n=_nSubLayers-1;
      for(int i=0;i < n;i++ ) {
        profile.setDepth(_topDepthIndex+i, _finalTopDepth + (double) (i + 1) * dz);
      }
      profile.setDepth(_topDepthIndex+n, _finalBottomDepth);
    }
    break;
  case PowerLaw: {
      double dz=(_finalBottomDepth - _finalTopDepth)/(pow( 2.0, _nSubLayers) - 1.0);
      double z=_finalTopDepth;
      int n=_nSubLayers-1;
      for(int i=0;i < n;i++ ) {
        z += dz;
        profile.setDepth(_topDepthIndex+i, z);
        dz *= 2.0;
      }
      profile.setDepth(_topDepthIndex+n, _finalBottomDepth);
    }
    break;
  }
}
void DinverDCCore::ParamLayer::setFinalProfileValues ( Profile profile,
double  topV,
double  bottomV 
) [protected]

Set intermediate depths according to shape

References _finalBottomDepth, _finalTopDepth, _nSubLayers, _shape, _topDepthIndex, QGpCoreWave::Profile::depths(), Linear, LinearDecrease, LinearIncrease, QGpCoreTools::log(), PowerLaw, QGpCoreWave::Profile::setValue(), TRACE, and Uniform.

Referenced by setFinalProfileValuesCondition(), and setFinalProfileValuesParam().

{
  TRACE;
  // TODO : titled layers
  switch (_shape) {
  case Uniform:
    profile.setValue(_topDepthIndex, topV);
    break;
  case Linear:
  case LinearIncrease:
  case LinearDecrease: {
      double h=_finalBottomDepth - _finalTopDepth;
      double dz=h/(double) _nSubLayers;
      double halfdz=0.5 * dz + _finalTopDepth;
      double slope=(bottomV - topV)/h;
      for(int i=0;i < _nSubLayers;i++ ) {
        int di=_topDepthIndex+i;
        profile.setValue(di, topV + slope * (profile.depths().at(di) - halfdz));
      }
    }
    break;
  case PowerLaw: {  // Simple power law: V=V0*(1.0+z-z0)^alpha
      double alpha=log(bottomV/topV)/log(_finalBottomDepth - _finalTopDepth + 1.0);
      double lastZ=_finalTopDepth;
      double z;
      for(int i=0;i < _nSubLayers;i++ ) {
        int di=_topDepthIndex+i;
        z=profile.depths().at(di);
        profile.setValue(di, topV * pow(1.0 + 0.5 * (z + lastZ) - _finalTopDepth, alpha) );
        lastZ=z;
      }
    }
    break;
  }
}
void DinverDCCore::ParamLayer::setIndex ( int  i) [inline]
void DinverDCCore::ParamLayer::setLinkedDepth ( bool  last,
ParamLayer prev,
RealSpace ps 
)

Check and add condition for depth across linked depths.

References _dhP, _isDepth, _ptrLink, DinverCore::RealSpace::addCondition(), and TRACE.

Referenced by DinverDCCore::ParamProfile::setLinkedDepth().

{
  TRACE;
  if(_ptrLink && !last) {
    static_cast<GroundParameter *>(_ptrLink->_dhP)->addLayer(this);
    if(_ptrLink->_isDepth) {
      _isDepth=true;
      _dhP=_ptrLink->_dhP;
      if(prev && prev->_isDepth && prev->_dhP)
        ps.addCondition(new SimpleCondition (_dhP, SimpleCondition::GreaterThan, 1.0, prev->_dhP, 0.0) );
    }
  }
  // In case of thickness linked: _dhLeftP and _dhRightP pointers are set to 0
}
void DinverDCCore::ParamLayer::setLinkedTo ( const QString &  l) [inline]

Set link name from link pointer. Used after inserting a new layer

References _linkedTo, _ptrLink, name(), and TRACE.

void DinverDCCore::ParamLayer::setMaximumDepth ( double  v) [inline]

Referenced by main(), and ParamLayerWidget::paramLayer().

{_dhMax=v;}
void DinverDCCore::ParamLayer::setMinimumDepth ( double  v) [inline]

Referenced by main(), and ParamLayerWidget::paramLayer().

{_dhMin=v;}
void DinverDCCore::ParamLayer::setNSubLayers ( int  n) [inline]

Referenced by main(), and ParamLayerWidget::paramLayer().

{_shape=s;}

Set the index of the top sub layer in the final profile, index is incremented by the number of sub layers for this layer.

References _nSubLayers, _shape, _topDepthIndex, index(), Linear, LinearDecrease, LinearIncrease, PowerLaw, and TRACE.

{
  TRACE;
  _topDepthIndex=index;
  switch (_shape) {
  case Linear:
  case LinearIncrease:
  case LinearDecrease:
  case PowerLaw:
    index+=_nSubLayers;
    break;
  default:
    index++;
    break;
  }
}
void DinverDCCore::ParamLayer::setTopMaximumValue ( double  v) [inline]
void DinverDCCore::ParamLayer::setTopMinimumValue ( double  v) [inline]

Referenced by ParamLayerWidget::setFrom().

{return _shape;}

Returns the current depth of the top

Referenced by DinverDCCore::PoissonCondition::getLimits(), and DinverDCCore::PoissonCondition::isOk().

{return _finalTopDepth;}
{return _topDepthIndex;}
double DinverDCCore::ParamLayer::topMaximumValue ( ) const [inline]

Referenced by ParamLayerWidget::setFrom().

{return _topMax;}
double DinverDCCore::ParamLayer::topMinimumValue ( ) const [inline]

Referenced by DinverDCCore::ParamProfile::toParam().

{return _topP;}
QString DinverDCCore::ParamLayer::unit ( ) const
bool DinverDCCore::ParamLayer::valueToParam ( RealSpace ps,
const ParamGroundModel groundModel 
)

References _bottomMax, _bottomMin, _bottomP, _shape, _topMax, _topMin, _topP, DinverCore::RealSpace::addCondition(), DinverCore::RealSpace::addParameter(), DinverCore::Parameter::initGrid(), Linear, LinearDecrease, LinearIncrease, PowerLaw, DinverCore::Parameter::setPrecision(), DinverCore::Parameter::setScale(), TRACE, Uniform, DinverDCCore::GroundParameter::ValueBottom, and DinverDCCore::GroundParameter::ValueTop.

Referenced by DinverDCCore::ParamProfile::toParam().

{
  TRACE;
  _topP=ps.addParameter(new GroundParameter(groundModel, this, GroundParameter::ValueTop, _topMin, _topMax));
  _topP->setScale(ParameterGrid::Log);
  _topP->setPrecision(0.01);
  if(!_topP->initGrid()) {
    return false;
  }
  switch (_shape) {
  case Uniform:
    _bottomP=_topP;
    break;
  case Linear:
    _bottomP=ps.addParameter(new GroundParameter(groundModel,  this, GroundParameter::ValueBottom, _bottomMin, _bottomMax));
    _bottomP->setScale(ParameterGrid::Log);
    _bottomP->setPrecision(0.01);
    if(!_bottomP->initGrid()) {
      return false;
    }
    break;
  case PowerLaw:
  case LinearIncrease:
    _bottomP=ps.addParameter(new GroundParameter(groundModel,  this, GroundParameter::ValueBottom, _bottomMin, _bottomMax));
    _bottomP->setScale(ParameterGrid::Log);
    _bottomP->setPrecision(0.01);
    if(!_bottomP->initGrid()) {
      return false;
    }
    ps.addCondition(new SimpleCondition (_bottomP, SimpleCondition::GreaterThan, 1.0, _topP, 0.0) );
    break;
  case LinearDecrease:
    _bottomP=ps.addParameter(new GroundParameter(groundModel,  this, GroundParameter::ValueBottom, _bottomMin, _bottomMax));
    _bottomP->setScale(ParameterGrid::Log);
    _bottomP->setPrecision(0.01);
    if(!_bottomP->initGrid()) {
      return false;
    }
    ps.addCondition(new SimpleCondition (_bottomP, SimpleCondition::LessThan, 1.0, _topP, 0.0) );
    break;
  }
  return true;
}

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(attributes)
  Q_UNUSED(context);
  if(tag=="shape" ) return XMLMember(0);
  else if(tag=="lastParamCondition" ) return XMLMember(1);
  else if(tag=="nSubayers" ) return XMLMember(2);
  else if(tag=="topMin" ) return XMLMember(3);
  else if(tag=="topMax" ) return XMLMember(4);
  else if(tag=="bottomMin" ) return XMLMember(5);
  else if(tag=="bottomMax" ) return XMLMember(6);
  else if(tag=="linkedTo" ) return XMLMember(7);
  else if(tag=="isDepth" ) return XMLMember(8);
  else if(tag=="dhMin" ) return XMLMember(9);
  else if(tag=="dhMax" ) return XMLMember(10);
  else if(tag=="tilted" ) return XMLMember(11); // Kept for compatibility
  else if(tag=="dhMinLeft" ) return XMLMember(9); // Kept for compatibility
  else if(tag=="dhMaxLeft" ) return XMLMember(10); // Kept for compatibility
  else if(tag=="dhMinRight" ) return XMLMember(11); // Kept for compatibility
  else if(tag=="dhMaxRight" ) return XMLMember(11); // Kept for compatibility
  else if(tag=="greaterThanPrevious" ) return XMLMember(1); // Kept for compatibility
  else return XMLMember(XMLMember::Unknown);
}

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.

References _bottomMax, _bottomMin, _dhMax, _dhMin, _isDepth, _lastParamCondition, _linkedTo, _nSubLayers, _shape, _topMax, _topMin, QGpCoreTools::endl(), Linear, LinearDecrease, LinearIncrease, PowerLaw, QGpCoreTools::tr(), TRACE, and Uniform.

{
  TRACE;
  Q_UNUSED(tag)
  Q_UNUSED(attributes)
  Q_UNUSED(context);
  switch (memberID) {
  case 0:
    if(content=="Uniform" ) _shape=Uniform;
    else if(content=="Linear" ) _shape=Linear;
    else if(content=="LinearIncrease" ) _shape=LinearIncrease;
    else if(content=="LinearDecrease" ) _shape=LinearDecrease;
    else if(content=="PowerLaw" ) _shape=PowerLaw;
    else if(content=="LinearIncr" ) _shape=LinearIncrease; // Kept for compatibility
    else if(content=="LinearDecr" ) _shape=LinearDecrease; // Kept for compatibility
    else {
      App::stream() << tr( "Unknown value %1 for shape" ).arg(content.toString()) << endl;
      return false;
    }
    return true;
  case 1:
    _lastParamCondition=content.toBool();
    return true;
  case 2:
    _nSubLayers=content.toInt();
    return true;
  case 3:
    _topMin=content.toDouble();
    return true;
  case 4:
    _topMax=content.toDouble();
    return true;
  case 5:
    _bottomMin=content.toDouble();
    return true;
  case 6:
    _bottomMax=content.toDouble();
    return true;
  case 7:
    _linkedTo=content.toString();
    return true;
  case 8:
    _isDepth=content.toBool();
    return true;
  case 9:
    _dhMin=content.toDouble();
    return true;
  case 10:
    _dhMax=content.toDouble();
    return true;
  case 11:
    return true;
  default:
    return false;
  }
}
virtual const QString& DinverDCCore::ParamLayer::xml_tagName ( ) const [inline, virtual]

Reimplemented from QGpCoreTools::XMLClass.

References _bottomMax, _bottomMin, _dhMax, _dhMin, _isDepth, _lastParamCondition, _linkedTo, _nSubLayers, _shape, _topMax, _topMin, Linear, LinearDecrease, LinearIncrease, PowerLaw, TRACE, Uniform, and QGpCoreTools::XMLClass::writeProperty().

{
  TRACE;
  Q_UNUSED(context);
  switch (_shape) {
  case Linear: writeProperty(s, "shape", "Linear" ); break;
  case LinearIncrease: writeProperty(s, "shape", "LinearIncrease" ); break;
  case LinearDecrease: writeProperty(s, "shape", "LinearDecrease" ); break;
  case PowerLaw: writeProperty(s, "shape", "PowerLaw" ); break;
  case Uniform: writeProperty(s, "shape", "Uniform" ); break;
  }
  writeProperty(s, "lastParamCondition", _lastParamCondition);
  writeProperty(s, "nSubayers", _nSubLayers);
  writeProperty(s, "topMin", _topMin);
  writeProperty(s, "topMax", _topMax);
  if(_shape!=Uniform) {
    writeProperty(s, "bottomMin", _bottomMin);
    writeProperty(s, "bottomMax", _bottomMax);
  }
  writeProperty(s, "linkedTo", _linkedTo);
  writeProperty(s, "isDepth", _isDepth);
  writeProperty(s, "dhMin", _dhMin);
  writeProperty(s, "dhMax", _dhMax);
}

Member Data Documentation

Referenced by fixedThickness(), name(), ParamLayer(), and unit().

const QString DinverDCCore::ParamLayer::xmlParamLayerTag = "ParamLayer" [static]

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