ASMu2D: make createLRNurbs return a shared_ptr directly
no reason to use bare pointers here, they are always put into a shared_ptr
This commit is contained in:
@@ -495,14 +495,15 @@ bool ASMu2D::evaluateBasis (int iel, FiniteElement& fe, int derivs) const
|
||||
}
|
||||
|
||||
|
||||
LR::LRSplineSurface* ASMu2D::createLRNurbs (const Go::SplineSurface& srf)
|
||||
std::shared_ptr<LR::LRSplineSurface>
|
||||
ASMu2D::createLRNurbs (const Go::SplineSurface& srf)
|
||||
{
|
||||
return new LR::LRSplineSurface(srf.numCoefs_u(), srf.numCoefs_v(),
|
||||
srf.order_u(), srf.order_v(),
|
||||
srf.basis_u().begin(),
|
||||
srf.basis_v().begin(),
|
||||
srf.rcoefs_begin(),
|
||||
srf.dimension()+1);
|
||||
return std::make_shared<LR::LRSplineSurface>(srf.numCoefs_u(), srf.numCoefs_v(),
|
||||
srf.order_u(), srf.order_v(),
|
||||
srf.basis_u().begin(),
|
||||
srf.basis_v().begin(),
|
||||
srf.rcoefs_begin(),
|
||||
srf.dimension()+1);
|
||||
}
|
||||
|
||||
|
||||
@@ -512,7 +513,7 @@ std::shared_ptr<LR::LRSplineSurface> ASMu2D::createLRfromTensor ()
|
||||
{
|
||||
if (tensorspline->rational())
|
||||
{
|
||||
lrspline.reset(createLRNurbs(*tensorspline));
|
||||
lrspline = createLRNurbs(*tensorspline);
|
||||
is_rational = true;
|
||||
}
|
||||
else if (tensorspline->dimension() > nsd)
|
||||
@@ -550,8 +551,8 @@ bool ASMu2D::generateFEMTopology ()
|
||||
|
||||
if (tensorPrjBas)
|
||||
{
|
||||
projB.reset(tensorPrjBas->rational() ? createLRNurbs(*tensorPrjBas)
|
||||
: new LR::LRSplineSurface(tensorPrjBas));
|
||||
projB = tensorPrjBas->rational() ? createLRNurbs(*tensorPrjBas)
|
||||
: std::make_shared<LR::LRSplineSurface>(tensorPrjBas);
|
||||
projB->generateIDs();
|
||||
delete tensorPrjBas;
|
||||
tensorPrjBas = nullptr;
|
||||
|
||||
@@ -690,7 +690,7 @@ protected:
|
||||
std::shared_ptr<LR::LRSplineSurface> createLRfromTensor();
|
||||
|
||||
//! \brief Converts a rational spline surface to a LR NURBS surface.
|
||||
static LR::LRSplineSurface* createLRNurbs(const Go::SplineSurface& srf);
|
||||
static std::shared_ptr<LR::LRSplineSurface> createLRNurbs(const Go::SplineSurface& srf);
|
||||
|
||||
//! \brief Generate bezier basis.
|
||||
void generateBezierBasis();
|
||||
|
||||
@@ -201,22 +201,23 @@ bool ASMu2Dmx::generateFEMTopology ()
|
||||
|
||||
auto createLR = [this](Go::SplineSurface& srf)
|
||||
{
|
||||
return srf.rational() ? this->createLRNurbs(srf)
|
||||
: new LR::LRSplineSurface(&srf);
|
||||
if (srf.rational())
|
||||
return this->createLRNurbs(srf);
|
||||
else
|
||||
return std::make_shared<LR::LRSplineSurface>(&srf);
|
||||
};
|
||||
|
||||
if (tensorPrjBas)
|
||||
{
|
||||
projB.reset(createLR(*tensorPrjBas));
|
||||
projB = createLR(*tensorPrjBas);
|
||||
delete tensorPrjBas;
|
||||
tensorPrjBas = nullptr;
|
||||
}
|
||||
|
||||
if (m_basis.empty()) {
|
||||
SurfaceVec svec = ASMmxBase::establishBases(tensorspline, ASMmxBase::Type);
|
||||
m_basis.resize(svec.size());
|
||||
for (size_t b = 0; b < svec.size(); b++)
|
||||
m_basis[b].reset(createLR(*svec[b]));
|
||||
m_basis.push_back(createLR(*svec[b]));
|
||||
|
||||
// we need to project on something that is not one of our bases
|
||||
if (ASMmxBase::Type == ASMmxBase::REDUCED_CONT_RAISE_BASIS1 ||
|
||||
@@ -228,14 +229,14 @@ bool ASMu2Dmx::generateFEMTopology ()
|
||||
otherBasis = ASMmxBase::raiseBasis(tensorspline);
|
||||
|
||||
if (ASMmxBase::Type == ASMmxBase::SUBGRID) {
|
||||
refBasis.reset(createLR(*otherBasis));
|
||||
refBasis = createLR(*otherBasis);
|
||||
if (!projB)
|
||||
projB = m_basis.front();
|
||||
projB2 = refBasis;
|
||||
}
|
||||
else {
|
||||
if (!projB)
|
||||
projB.reset(createLR(*otherBasis));
|
||||
projB = createLR(*otherBasis);
|
||||
refBasis = std::static_pointer_cast<LR::LRSplineSurface>(projB);
|
||||
}
|
||||
delete otherBasis;
|
||||
|
||||
Reference in New Issue
Block a user