fixed: truebeta refinement was broken

need to remap to elements, not basis functions
This commit is contained in:
Arne Morten Kvarving
2017-12-08 11:18:43 +01:00
parent 4330cf335f
commit 4f9af6cc4a
10 changed files with 45 additions and 14 deletions

View File

@@ -168,7 +168,9 @@ public:
//! \brief Remaps element-wise errors from geometry mesh to refinement mesh.
//! \param[out] errors The remapped errors
//! \param[in] orig The element-wise errors on the geometry mesh
virtual void remapErrors(RealArray& errors, const RealArray& orig) const = 0;
//! \param[in] elemErrors If true, map to elements instead of basis functions
virtual void remapErrors(RealArray& errors, const RealArray& orig,
bool elemErrors = false) const = 0;
//! \brief Match neighbours after refinement in multipatch models.
//! \param neigh Neigbouring patch

View File

@@ -2180,10 +2180,16 @@ bool ASMu2D::matchNeighbour (ASMunstruct* neigh, int midx, int sidx, int orient)
}
void ASMu2D::remapErrors (RealArray& errors, const RealArray& origErr) const
void ASMu2D::remapErrors (RealArray& errors,
const RealArray& origErr, bool elemErrors) const
{
const LR::LRSplineSurface* basis = this->getBasis(1);
if (elemErrors) {
errors = origErr;
return;
}
for (const LR::Element* elm : basis->getAllElements())
for (const LR::Basisfunction* b : elm->support())
errors[b->getId()] += origErr[elm->getId()];

View File

@@ -504,7 +504,9 @@ protected:
//! \brief Remap element wise errors to basis functions.
//! \param errors The remapped errors
//! \param[in] origErr The element wise errors on the geometry mesh
virtual void remapErrors(RealArray& errors, const RealArray& origErr) const;
//! \param[in] elemErrors If true, map to elements instead of basis functions
virtual void remapErrors(RealArray& errors,
const RealArray& origErr, bool elemErrors) const;
public:
//! \brief Returns the number of elements on a boundary.

View File

@@ -911,7 +911,8 @@ void ASMu2Dmx::getBoundaryNodes (int lIndex, IntVec& nodes, int basis,
}
void ASMu2Dmx::remapErrors(RealArray& errors, const RealArray& origErr) const
void ASMu2Dmx::remapErrors(RealArray& errors,
const RealArray& origErr, bool elemErrors) const
{
const LR::LRSplineSurface* basis = this->getBasis(1);
const LR::LRSplineSurface* geo = this->getBasis(ASMmxBase::geoBasis);
@@ -919,7 +920,10 @@ void ASMu2Dmx::remapErrors(RealArray& errors, const RealArray& origErr) const
for (const LR::Element* elm : basis->getAllElements()) {
int gEl = geo->getElementContaining((elm->umin()+elm->umax())/2.0,
(elm->vmin()+elm->vmax())/2.0) + 1;
for (const LR::Basisfunction* b : elm->support())
errors[b->getId()] += origErr[gEl-1];
if (elemErrors)
errors[elm->getId()] = origErr[gEl-1];
else
for (const LR::Basisfunction* b : elm->support())
errors[b->getId()] += origErr[gEl-1];
}
}

View File

@@ -196,7 +196,9 @@ public:
//! \brief Remap (geometry) element wise errors to refinement basis functions.
//! \param errors The remapped errors
//! \param[in] origErr The element wise errors on the geometry mesh
virtual void remapErrors(RealArray& errors, const RealArray& origErr) const;
//! \param[in] elemErrors If true, map to elements instead of basis functions
virtual void remapErrors(RealArray& errors,
const RealArray& origErr, bool elemErrors) const;
protected:
//! \brief Assembles L2-projection matrices for the secondary solution.

View File

@@ -2250,10 +2250,16 @@ bool ASMu3D::matchNeighbour(ASMunstruct* neigh, int midx, int sidx, int orient)
}
void ASMu3D::remapErrors (RealArray& errors, const RealArray& origErr) const
void ASMu3D::remapErrors (RealArray& errors,
const RealArray& origErr, bool elemErrors) const
{
const LR::LRSplineVolume* basis = this->getBasis(1);
if (elemErrors) {
errors = origErr;
return;
}
for (const LR::Element* elm : basis->getAllElements())
for (const LR::Basisfunction* b : elm->support())
errors[b->getId()] += origErr[elm->getId()];

View File

@@ -501,7 +501,9 @@ protected:
//! \brief Remap element wise errors to basis functions.
//! \param errors The remapped errors
//! \param[in] origErr The element wise errors on the geometry mesh
virtual void remapErrors(RealArray& errors, const RealArray& origErr) const;
//! \param[in] elemErrors If true, map to elements instead of basis functions
virtual void remapErrors(RealArray& errors,
const RealArray& origErr, bool elemErrors) const;
public:
//! \brief Returns the number of elements on a boundary.

View File

@@ -899,7 +899,8 @@ Vec3 ASMu3Dmx::getCoord (size_t inod) const
}
void ASMu3Dmx::remapErrors(RealArray& errors, const RealArray& origErr) const
void ASMu3Dmx::remapErrors (RealArray& errors,
const RealArray& origErr, bool elemErrors) const
{
const LR::LRSplineVolume* basis = this->getBasis(1);
const LR::LRSplineVolume* geo = this->getBasis(ASMmxBase::geoBasis);
@@ -908,7 +909,10 @@ void ASMu3Dmx::remapErrors(RealArray& errors, const RealArray& origErr) const
int gEl = geo->getElementContaining((elm->umin()+elm->umax())/2.0,
(elm->vmin()+elm->vmax())/2.0,
(elm->wmin()+elm->wmax())/2.0) + 1;
for (LR::Basisfunction* b : elm->support())
errors[b->getId()] += origErr[gEl-1];
if (elemErrors)
errors[elm->getId()] = origErr[gEl-1];
else
for (LR::Basisfunction* b : elm->support())
errors[b->getId()] += origErr[gEl-1];
}
}

View File

@@ -166,7 +166,9 @@ public:
//! \brief Remap (geometry) element wise errors to refinement basis functions.
//! \param errors The remapped errors
//! \param[in] origErr The element wise errors on the geometry mesh
virtual void remapErrors(RealArray& errors, const RealArray& origErr) const;
//! \param[in] elemErrors If true, map to elements instead of basis functions
virtual void remapErrors(RealArray& errors,
const RealArray& origErr, bool elemErrors) const;
private:
std::vector<std::shared_ptr<LR::LRSplineVolume>> m_basis; //!< Spline bases

View File

@@ -333,7 +333,8 @@ bool AdaptiveSIM::adaptMesh (int iStep)
<<" percent."<< std::endl;
prm.errors.resize(model.getPatch(1)->getNoNodes(1));
static_cast<ASMunstruct*>(model.getPatch(1))->remapErrors(prm.errors,
eNorm.getRow(eRow));
eNorm.getRow(eRow),
true);
if (!storeMesh)
return model.refine(prm);