added: make function for refinement based on a density function virtual in ASMunstruct

add implementation for 3D LR
This commit is contained in:
Arne Morten Kvarving
2017-12-12 14:14:24 +01:00
parent 982eb0ce3e
commit 9fc12d31dd
3 changed files with 38 additions and 0 deletions

View File

@@ -203,6 +203,11 @@ public:
const RealArray& oldVars, RealArray& newVars,
int nGauss, int nf = 1) const;
//! \brief Refines the parametrization based on a mesh density function.
//! \param[in] refC Mesh refinement criteria function
//! \param[in] refTol Mesh refinement threshold
virtual bool refine(const RealFunc& refC, double refTol) = 0;
protected:
LR::LRSpline* geo; //!< Pointer to the actual spline geometry object

View File

@@ -2409,3 +2409,31 @@ bool ASMu3D::transferCntrlPtVars (const LR::LRSpline* old_basis,
return true;
}
/*!
Refines all elements for which refC(X0) < refTol,
where X0 is the element center.
*/
bool ASMu3D::refine (const RealFunc& refC, double refTol)
{
Go::Point X0;
std::vector<int> elements;
std::vector<LR::Element*>::const_iterator eit = lrspline->elementBegin();
for (int iel = 0; eit != lrspline->elementEnd(); iel++, ++eit)
{
double u0 = 0.5*((*eit)->umin() + (*eit)->umax());
double v0 = 0.5*((*eit)->vmin() + (*eit)->vmax());
double w0 = 0.5*((*eit)->wmin() + (*eit)->wmax());
lrspline->point(X0,u0,v0,w0);
if (refC(SplineUtils::toVec3(X0,nsd)) < refTol)
elements.push_back(iel);
}
Vectors dummySol;
LR::RefineData prm(true);
prm.options = { 10, 1, 2 };
prm.elements = this->getFunctionsForElements(elements);
return this->refine(prm,dummySol);
}

View File

@@ -363,6 +363,11 @@ public:
virtual bool transferCntrlPtVars(const LR::LRSpline* old_basis,
RealArray& newVars, int nGauss) const;
//! \brief Refines the parametrization based on a mesh density function.
//! \param[in] refC Mesh refinement criteria function
//! \param[in] refTol Mesh refinement threshold
virtual bool refine(const RealFunc& refC, double refTol);
private:
//! \brief Struct representing an inhomogeneous Dirichlet boundary condition.
struct DirichletFace