Skip to content

Commit

Permalink
Alias
Browse files Browse the repository at this point in the history
  • Loading branch information
jschueller committed Oct 11, 2024
1 parent 8ae4b7c commit 2525abb
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions lib/src/InverseFORM.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <openturns/DeconditionedDistribution.hxx>
#else
#include <openturns/ConditionalDistribution.hxx>
#define DeconditionedDistribution ConditionalDistribution
#endif


Expand Down Expand Up @@ -234,21 +235,13 @@ Function InverseFORM::getG(const Scalar p)
newFunction.setParameter(params);
RandomVector antecedent(event_.getImplementation()->getAntecedent().getImplementation()->clone());
const Distribution distribution(antecedent.getDistribution());
#if OPENTURNS_VERSION >= 102300
const JointDistribution * p_joint = dynamic_cast<JointDistribution *>(distribution.getImplementation().get());
#else
const JointDistribution * p_joint = dynamic_cast<JointDistribution *>(distribution.getImplementation().get());
#endif
if (p_joint)
{
JointDistribution::DistributionCollection distributionCollection(p_joint->getDistributionCollection());
for (UnsignedInteger i = 0; i < distributionCollection.getSize(); ++ i)
{
#if OPENTURNS_VERSION >= 102400
if (distributionCollection[i].getImplementation()->getClassName() == "DeconditionedDistribution")
#else
if (distributionCollection[i].getImplementation()->getClassName() == "ConditionalDistribution")
#endif
if (Description({"DeconditionedDistribution", "ConditionalDistribution"}).contains(distributionCollection[i].getImplementation()->getClassName()))
{
DistributionImplementation::PointWithDescriptionCollection parametersCollection(distributionCollection[i].getParametersCollection());
for (UnsignedInteger j = 0; j < parametersCollection.getSize(); ++ j)
Expand All @@ -263,22 +256,13 @@ Function InverseFORM::getG(const Scalar p)
}
}
}
#if OPENTURNS_VERSION >= 102400
const DeconditionedDistribution * p_conditional = dynamic_cast<DeconditionedDistribution
*>(distributionCollection[i].getImplementation().get());
#else
const ConditionalDistribution * p_conditional = dynamic_cast<ConditionalDistribution
*>(distributionCollection[i].getImplementation().get());
#endif
if (p_conditional)
{
Distribution conditioning(p_conditional->getConditioningDistribution());
conditioning.setParametersCollection(parametersCollection);
#if OPENTURNS_VERSION >= 102400
DeconditionedDistribution newConditional(p_conditional->getConditionedDistribution(), conditioning);
#else
ConditionalDistribution newConditional(p_conditional->getConditionedDistribution(), conditioning);
#endif
distributionCollection[i] = newConditional;
JointDistribution newDistribution(distributionCollection);
antecedent = RandomVector(newDistribution);
Expand Down

0 comments on commit 2525abb

Please sign in to comment.