#include <ParamProfile.h>
References _defaultCondition, _defaultMaximum, _defaultMinimum, _type, Param, and TRACE.
{
TRACE;
_defaultMinimum=100;
_defaultMaximum=5000;
_type=Param;
_defaultCondition=SimpleCondition::LessThan;
}
| DinverDCCore::ParamProfile::ParamProfile | ( | const ParamProfile & | o | ) |
Copy constructor. Used only by copy constructor of ParamGroundModel.
References _defaultCondition, _defaultMaximum, _defaultMinimum, _layers, _longName, _shortName, _type, _unit, layer(), DinverDCCore::ParamLayer::setProfile(), and TRACE.
: XMLClass() { TRACE; _longName=o._longName; _shortName=o._shortName; _unit=o._unit; _defaultMinimum=o._defaultMinimum; _defaultMaximum=o._defaultMaximum; _defaultCondition=o._defaultCondition; _type=o._type; LayerList::const_iterator it; for(it=o._layers.begin();it!=o._layers.end();++it) { ParamLayer * layer=new ParamLayer( **it); layer->setProfile(this); _layers.append(layer); } }
| DinverDCCore::ParamProfile::ParamProfile | ( | QString | shortName, |
| QString | longName, | ||
| QString | unit, | ||
| double | defaultMinimum, | ||
| double | defaultMaximum, | ||
| Type | type, | ||
| SimpleCondition::Type | defaultCondition | ||
| ) |
References _defaultCondition, _defaultMaximum, _defaultMinimum, _longName, _shortName, _type, _unit, defaultCondition(), defaultMaximum(), defaultMinimum(), longName(), shortName(), TRACE, type(), and unit().
| DinverDCCore::ParamProfile::~ParamProfile | ( | ) | [virtual] |
| void DinverDCCore::ParamProfile::addLayer | ( | ParamLayer * | layer | ) | [inline] |
| void DinverDCCore::ParamProfile::collectDepthLinks | ( | LayerMap & | links | ) |
Append all layers (except half spaces) to layer map links.
References _layers, layer(), DinverDCCore::ParamLayer::name(), and TRACE.
| void DinverDCCore::ParamProfile::collectDepths | ( | QVector< double > & | depths | ) | const [inline] |
{_raw.collectDepths(depths);}
| void DinverDCCore::ParamProfile::collectValueParameters | ( | QList< Parameter * > & | params | ) | const |
Append all value parameters that describe this profile to params.
References _layers, DinverDCCore::ParamLayer::collectValueParameters(), layer(), and TRACE.
Referenced by DinverDCCore::PoissonCondition::PoissonCondition().
| SimpleCondition::Type DinverDCCore::ParamProfile::defaultCondition | ( | ) | const [inline] |
Referenced by ParamProfile(), and ParamProfileWidget::setFrom().
{return _defaultCondition;}
| double DinverDCCore::ParamProfile::defaultMaximum | ( | ) | const [inline] |
Referenced by DinverDCCore::ParamLayer::ParamLayer(), ParamProfile(), and ParamProfileWidget::setFrom().
{return _defaultMaximum;}
| double DinverDCCore::ParamProfile::defaultMinimum | ( | ) | const [inline] |
Referenced by DinverDCCore::ParamLayer::ParamLayer(), ParamProfile(), and ParamProfileWidget::setFrom().
{return _defaultMinimum;}
| bool DinverDCCore::ParamProfile::hasGradient | ( | ) | const |
References _layers, TRACE, and DinverDCCore::ParamLayer::Uniform.
{
TRACE;
LayerList::const_iterator it;
for(it=_layers.begin();it!=_layers.end();++it) {
if((*it)->shape()!=ParamLayer::Uniform) return true;
}
return false;
}
| void DinverDCCore::ParamProfile::insertLayer | ( | int | at, |
| ParamLayer * | layer | ||
| ) |
Inserts layer at index at. Never call this function directly, use ParamGroundModel::insertLayer() instead.
References _layers, nLayers(), DinverDCCore::ParamLayer::setIndex(), and TRACE.
Referenced by DinverDCCore::ParamGroundModel::insertLayer().
| ParamLayer* DinverDCCore::ParamProfile::layer | ( | int | index | ) | const [inline] |
Referenced by collectDepthLinks(), collectValueParameters(), DinverDCCore::ParamLayer::fixedBottomDepth(), DinverDCCore::ParamLayer::fixedThickness(), ParamProfile(), Model2ParamReader::parse(), setDepthLinkNames(), setDepthLinks(), ParamProfileWidget::setFrom(), setLinkedDepth(), ParamProfileWidget::setLinksFrom(), and toParam().
{return _layers.at(index);}
| const QString& DinverDCCore::ParamProfile::longName | ( | ) | const [inline] |
Referenced by ParamProfile(), and ParamProfileWidget::setFrom().
{return _longName;}
| const Profile& DinverDCCore::ParamProfile::maxRawProfile | ( | ) | const [inline] |
Referenced by DinverDCCore::TargetList2D::misfit().
{return _maxRaw;}
| const Profile& DinverDCCore::ParamProfile::maxResampledProfile | ( | ) | const [inline] |
Referenced by DinverDCCore::PoissonCondition::getLimits(), DinverDCCore::PoissonCondition::isOk(), and DinverDCCore::TargetList::misfit().
{return _maxResampled;}
| Profile& DinverDCCore::ParamProfile::maxResampledProfile | ( | ) | [inline] |
{return _maxResampled;}
| const Profile& DinverDCCore::ParamProfile::minRawProfile | ( | ) | const [inline] |
| const Profile& DinverDCCore::ParamProfile::minResampledProfile | ( | ) | const [inline] |
References _minResampled.
Referenced by DinverDCCore::PoissonCondition::getLimits(), DinverDCCore::PoissonCondition::isOk(), and DinverDCCore::TargetList::misfit().
{return _minResampled;}
| Profile& DinverDCCore::ParamProfile::minResampledProfile | ( | ) | [inline] |
References _minResampled.
{return _minResampled;}
| int DinverDCCore::ParamProfile::nLayers | ( | ) | const [inline] |
| void DinverDCCore::ParamProfile::pMaxRaw | ( | ) | const |
| void DinverDCCore::ParamProfile::pMaxResampled | ( | ) | const |
Debug: prints maximum resamples profile
References _maxResampled, QGpCoreWave::Profile::print(), and TRACE.
{
TRACE;
_maxResampled.print();
}
| void DinverDCCore::ParamProfile::pRaw | ( | ) | const |
| void DinverDCCore::ParamProfile::pResampled | ( | ) | const |
Debug: prints resampled profile
References _resampled, QGpCoreWave::Profile::print(), and TRACE.
{
TRACE;
_resampled.print();
}
| const Profile& DinverDCCore::ParamProfile::rawProfile | ( | ) | const [inline] |
Referenced by DinverDCCore::TargetList2D::misfit().
{return _raw;}
| const Profile& DinverDCCore::ParamProfile::resampledProfile | ( | ) | const [inline] |
| Profile& DinverDCCore::ParamProfile::resampledProfile | ( | ) | [inline] |
{return _resampled;}
| void DinverDCCore::ParamProfile::resampleProfile | ( | QVector< double > & | baseD | ) | [inline] |
References _maxRaw, _maxResampled, _raw, _resampled, _type, Condition, QGpCoreWave::Profile::resample(), and TRACE.
{
TRACE;
_resampled.resample(_raw, baseD);
if(_type==Condition) _maxResampled.resample(_maxRaw, baseD);
}
Set link names in each layer from the link pointers.
References _layers, layer(), DinverDCCore::ParamLayer::setLinkedTo(), and TRACE.
| void DinverDCCore::ParamProfile::setDepthLinks | ( | const LayerMap & | links | ) |
Set the link pointers from the link names and from the layer map links.
References _layers, layer(), DinverDCCore::ParamLayer::linkedTo(), DinverDCCore::ParamLayer::setPtrLink(), and TRACE.
| void DinverDCCore::ParamProfile::setFinalDepths | ( | int | fromLayer = 0 | ) |
Called routinely during inversion, it inits the depths from parameter values. Linked depth parameters are not considered.
References _layers, and TRACE.
Referenced by DinverDCCore::ParamGroundModel::updateFinalProfiles().
| void DinverDCCore::ParamProfile::setFinalProfileAt | ( | int | layer | ) |
| void DinverDCCore::ParamProfile::setFinalProfileDepths | ( | int | fromLayer = 0 | ) |
Called routinely during inversion, it inits the depths from parameter values. Linked depth parameters are considered to build the final depth profile.
References _layers, _maxRaw, _minRaw, _raw, _type, Condition, Param, and TRACE.
Referenced by DinverDCCore::ParamGroundModel::updateFinalProfiles().
{
TRACE;
double z;
if(fromLayer==0) {
z=0.0;
} else {
z=_layers.at(fromLayer)->topDepth();
}
int n=_layers.count();
switch (_type) {
case Param:
for(int i=fromLayer; i<n; i++) {
_layers.at(i)->setFinalProfileDepthsParam(_raw, z);
}
break;
case Condition:
for(int i=fromLayer; i<n; i++) {
_layers.at(i)->setFinalProfileDepthsCondition(_minRaw, _maxRaw, z);
}
break;
}
}
| void DinverDCCore::ParamProfile::setFinalProfileFrom | ( | int | layer = 0 | ) |
| void DinverDCCore::ParamProfile::setLinkedDepth | ( | RealSpace & | ps | ) |
Delayed resolution of linked depths Needed by profiles for checking and adding condition for depth (across linked depths).
References _layers, layer(), DinverDCCore::ParamLayer::setLinkedDepth(), and TRACE.
| const QString& DinverDCCore::ParamProfile::shortName | ( | ) | const [inline] |
| bool DinverDCCore::ParamProfile::toParam | ( | RealSpace & | ps, |
| LayerMap & | links, | ||
| const ParamGroundModel * | groundModel | ||
| ) |
References _defaultCondition, _layers, _maxRaw, _minRaw, _type, DinverCore::RealSpace::addCondition(), DinverDCCore::ParamLayer::bottomParam(), DinverDCCore::ParamLayer::depthToParam(), QGpCoreTools::endl(), DinverDCCore::ParamLayer::isLastParamCondition(), layer(), DinverDCCore::ParamLayer::linkedTo(), DinverDCCore::ParamLayer::name(), nLayers(), Param, DinverDCCore::ParamLayer::setFinalProfileValuesCondition(), DinverDCCore::ParamLayer::setPtrLink(), DinverDCCore::ParamLayer::topParam(), QGpCoreTools::tr(), TRACE, and DinverDCCore::ParamLayer::valueToParam().
{
TRACE;
int nLayers=_layers.size();
int lastLayer=nLayers - 1; // half space index
ParamLayer * layer;
ParamLayer * prevLayer=0;
for(int iLayer=0; iLayer<nLayers; iLayer++ ) {
layer=_layers.at(iLayer);
if(layer->linkedTo()!="Not linked" && iLayer!=lastLayer) {
// Links may be cascaded, look carefully for circular references
LayerList browsedLinks;
LayerList::iterator it;
ParamLayer * link=layer;
while(link && link->linkedTo()!="Not linked" ) {
if(browsedLinks.contains(link)) {
App::stream() << tr( "Circular referecences for depth links" ) << endl;
LayerList::iterator it;
for(it=browsedLinks.begin();it!=browsedLinks.end();++it) {
App::stream() << tr( " %1 ---> %2" ).arg(( *it) ->name()).arg(( *it) ->linkedTo()) << endl;
}
return false;
} else browsedLinks.append(link);
LayerMap::iterator itMap=links.find(link->linkedTo());
if(itMap!=links.end()) link=itMap.value(); else link=0;
}
if(!link) {
App::stream() << tr( "Bad depth link %1 for parameter %2" ).arg(layer->linkedTo()).arg(layer->name()) << endl;
return false;
} else layer->setPtrLink(link);
} else layer->setPtrLink(0);
// Convert layer into parameters
if(_type==Param) {
if(!layer->valueToParam(ps, groundModel)) {
App::stream() << tr("Error initializing parameter %1").arg(layer->name()) << endl;
return false;
}
} else {
layer->setFinalProfileValuesCondition(_minRaw, _maxRaw);
}
if(!layer->depthToParam(iLayer==lastLayer, prevLayer, ps, groundModel)) {
App::stream() << tr("Error initializing parameter %1").arg(layer->name()) << endl;
return false;
}
// Condition between neighbour layers
if(_type==Param) {
if(prevLayer && layer->isLastParamCondition()) {
switch (_defaultCondition) {
case SimpleCondition::LessThan:
ps.addCondition(new SimpleCondition (prevLayer->bottomParam(), SimpleCondition::LessThan, 1.0, layer->topParam(), 0.0) );
break;
case SimpleCondition::GreaterThan:
ps.addCondition(new SimpleCondition (prevLayer->bottomParam(), SimpleCondition::GreaterThan, 1.0, layer->topParam(), 0.0) );
break;
case SimpleCondition::NoCondition:
break;
}
}
}
prevLayer=layer;
}
return true;
}
| Type DinverDCCore::ParamProfile::type | ( | ) | const [inline] |
Referenced by ParamProfile(), ParamProfileWidget::setFrom(), DinverDCCore::TargetList::setParamProfiles(), ModelGenerator::setParamSpace(), and Forward::setParamSpace().
{return _type;}
| const QString& DinverDCCore::ParamProfile::unit | ( | ) | const [inline] |
Referenced by ParamProfile(), ParamProfileWidget::setFrom(), and DinverDCCore::ParamLayer::unit().
{return _unit;}
| void DinverDCCore::ParamProfile::writeReport | ( | QDataStream & | s | ) | const [inline] |
{_resampled.writeReport(s);}
| XMLMember DinverDCCore::ParamProfile::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.
References _layers, nLayers(), and TRACE.
{
TRACE;
Q_UNUSED(attributes)
Q_UNUSED(context);
if(tag=="longName" ) return XMLMember(0);
else if(tag=="shortName" ) return XMLMember(1);
else if(tag=="unit" ) return XMLMember(2);
else if(tag=="type" ) return XMLMember(6);
else if(tag=="defaultMinimum" ) return XMLMember(3);
else if(tag=="defaultMaximum" ) return XMLMember(4);
else if(tag=="defaultCondition" ) return XMLMember(5);
else if(tag=="ParamLayer" ) {
ParamLayer * l=new ParamLayer(this, nLayers());
_layers.append(l);
return XMLMember(l);
} else if(tag=="minDefault") return XMLMember(3); // Kept for compatibility
else if(tag=="maxDefault") return XMLMember(4); // Kept for compatibility
else return XMLMember(XMLMember::Unknown);
}
| bool DinverDCCore::ParamProfile::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.
References _defaultCondition, _defaultMaximum, _defaultMinimum, _longName, _shortName, _type, _unit, Condition, Param, and TRACE.
{
TRACE;
Q_UNUSED(tag)
Q_UNUSED(context);
Q_UNUSED(attributes)
switch (memberID) {
case 0: _longName=content.toString(); return true;
case 1: _shortName=content.toString(); return true;
case 2: _unit=content.toString(); return true;
case 3: _defaultMinimum=content.toDouble(); return true;
case 4: _defaultMaximum=content.toDouble(); return true;
case 5: {
bool ok=true;
_defaultCondition=SimpleCondition::fromString(content.toString(), ok);
return ok;
}
case 6:
if(content=="Condition" )
_type=Condition;
else
_type=Param;
return true;
default: return false;
}
}
| virtual const QString& DinverDCCore::ParamProfile::xml_tagName | ( | ) | const [inline, protected, virtual] |
Implements QGpCoreTools::XMLClass.
{return xmlParamProfileTag;}
| void DinverDCCore::ParamProfile::xml_writeChildren | ( | XML_WRITECHILDREN_ARGS | ) | const [protected, virtual] |
Reimplemented from QGpCoreTools::XMLClass.
References _layers, QGpCoreTools::XMLSaveAttributes::add(), and TRACE.
{
TRACE;
LayerList::const_iterator it;
static const QString key("name");
XMLSaveAttributes att;
QString& value=att.add(key);
for(it=_layers.begin();it!=_layers.end();++it) {
value=( *it) ->name();
( *it) ->xml_save(s, context, att);
}
}
| void DinverDCCore::ParamProfile::xml_writeProperties | ( | XML_WRITEPROPERTIES_ARGS | ) | const [protected, virtual] |
Reimplemented from QGpCoreTools::XMLClass.
References _defaultCondition, _defaultMaximum, _defaultMinimum, _longName, _shortName, _type, _unit, Param, TRACE, and QGpCoreTools::XMLClass::writeProperty().
{
TRACE;
Q_UNUSED(context);
writeProperty(s, "type", _type==Param ? "Param" : "Condition" );
writeProperty(s, "longName", _longName);
writeProperty(s, "shortName", _shortName);
writeProperty(s, "unit", _unit);
writeProperty(s, "defaultMinimum", _defaultMinimum);
writeProperty(s, "defaultMaximum", _defaultMaximum);
writeProperty(s, "defaultCondition", SimpleCondition::toString(_defaultCondition));
}
Referenced by ParamProfile(), toParam(), xml_setProperty(), and xml_writeProperties().
double DinverDCCore::ParamProfile::_defaultMaximum [protected] |
Referenced by ParamProfile(), xml_setProperty(), and xml_writeProperties().
double DinverDCCore::ParamProfile::_defaultMinimum [protected] |
Referenced by ParamProfile(), xml_setProperty(), and xml_writeProperties().
LayerList DinverDCCore::ParamProfile::_layers [protected] |
Referenced by collectDepthLinks(), collectValueParameters(), hasGradient(), initFinalProfile(), insertLayer(), ParamProfile(), setDepthLinkNames(), setDepthLinks(), setFinalDepths(), setFinalProfileAt(), setFinalProfileDepths(), setFinalProfileFrom(), setLinkedDepth(), toParam(), xml_member(), xml_writeChildren(), and ~ParamProfile().
QString DinverDCCore::ParamProfile::_longName [protected] |
Referenced by ParamProfile(), xml_setProperty(), and xml_writeProperties().
Profile DinverDCCore::ParamProfile::_maxRaw [protected] |
Referenced by initFinalProfile(), pMaxRaw(), resampleProfile(), setFinalProfileDepths(), and toParam().
Profile DinverDCCore::ParamProfile::_maxResampled [protected] |
Referenced by pMaxResampled(), and resampleProfile().
Profile DinverDCCore::ParamProfile::_raw [protected] |
Referenced by initFinalProfile(), pRaw(), resampleProfile(), setFinalProfileAt(), setFinalProfileDepths(), and setFinalProfileFrom().
Profile DinverDCCore::ParamProfile::_resampled [protected] |
Referenced by pResampled(), and resampleProfile().
QString DinverDCCore::ParamProfile::_shortName [protected] |
Referenced by ParamProfile(), xml_setProperty(), and xml_writeProperties().
Type DinverDCCore::ParamProfile::_type [protected] |
QString DinverDCCore::ParamProfile::_unit [protected] |
Referenced by ParamProfile(), xml_setProperty(), and xml_writeProperties().
const QString DinverDCCore::ParamProfile::xmlParamProfileTag = "ParamProfile" [static, protected] |