added: getProjectedField

this returns a scalar field over the projection basis
with the given coefficients.
This commit is contained in:
Arne Morten Kvarving 2022-04-25 09:52:26 +02:00
parent fa73096ebe
commit 1d88adf5af
10 changed files with 74 additions and 2 deletions

View File

@ -670,6 +670,10 @@ public:
//! \brief Returns the number of elements on refinement basis for this patch.
virtual size_t getNoRefineElms() const { return this->getNoElms(); }
//! \brief Returns a field using the projection basis.
virtual Field* getProjectedField(const Vector&) const
{ return nullptr; }
//! \brief Returns a field using the projection basis.
virtual Fields* getProjectedFields(const Vector&, size_t) const
{ return nullptr; }

View File

@ -26,6 +26,7 @@
#include "CoordinateMapping.h"
#include "GaussQuadrature.h"
#include "ElementBlock.h"
#include "SplineField2D.h"
#include "SplineFields2D.h"
#include "SplineUtils.h"
#include "Utilities.h"
@ -3126,6 +3127,18 @@ int ASMs2D::getCorner (int I, int J, int basis) const
}
Field* ASMs2D::getProjectedField (const Vector& coefs) const
{
if (this->getNoProjectionNodes() == coefs.size())
return new SplineField2D(proj,coefs);
std::cerr <<" *** ASMs2D::getProjectedField: Non-matching coefficent array,"
<<" size="<< coefs.size() <<" nnod="<< this->getNoProjectionNodes()
<< std::endl;
return nullptr;
}
Fields* ASMs2D::getProjectedFields (const Vector& coefs, size_t) const
{
if (proj == this->getBasis(1) || this->getNoProjectionNodes() == 0)

View File

@ -698,6 +698,10 @@ public:
void extractBasis(double u, double v, int dir, int p, Vector& dN,
bool fromRight = true) const;
//! \brief Returns a field using the projection basis.
//! \param[in] coefs The coefficients for the field
virtual Field* getProjectedField(const Vector& coefs) const;
//! \brief Returns a field using the projection basis.
//! \param[in] coefs The coefficients for the field
virtual Fields* getProjectedFields(const Vector& coefs, size_t = 0) const;

View File

@ -25,6 +25,7 @@
#include "CoordinateMapping.h"
#include "GaussQuadrature.h"
#include "ElementBlock.h"
#include "SplineField3D.h"
#include "SplineFields3D.h"
#include "SplineUtils.h"
#include "Utilities.h"
@ -3636,6 +3637,18 @@ bool ASMs3D::getFaceSize (int& n1, int& n2, int basis, int face) const
}
Field* ASMs3D::getProjectedField (const Vector& coefs) const
{
if (this->getNoProjectionNodes() == coefs.size())
return new SplineField3D(proj,coefs);
std::cerr <<" *** ASMs3D::getProjectedField: Non-matching coefficent array,"
<<" size="<< coefs.size() <<" nnod="<< this->getNoProjectionNodes()
<< std::endl;
return nullptr;
}
Fields* ASMs3D::getProjectedFields (const Vector& coefs, size_t) const
{
if (proj == this->getBasis(1) || this->getNoProjectionNodes() == 0)

View File

@ -775,6 +775,10 @@ public:
void extractBasis(double u, double v, double w, int dir, int p, Vector& dN,
bool fromRight = true) const;
//! \brief Returns a field using the projection basis.
//! \param[in] coefs The coefficients for the field
virtual Field* getProjectedField(const Vector& coefs) const;
//! \brief Returns a field using the projection basis.
//! \param[in] coefs The coefficients for the field
virtual Fields* getProjectedFields(const Vector& coefs, size_t = 0) const;

View File

@ -26,6 +26,7 @@
#include "CoordinateMapping.h"
#include "GaussQuadrature.h"
#include "LagrangeInterpolator.h"
#include "LRSplineField2D.h"
#include "LRSplineFields2D.h"
#include "ElementBlock.h"
#include "MPC.h"
@ -2444,6 +2445,18 @@ bool ASMu2D::separateProjectionBasis () const
}
Field* ASMu2D::getProjectedField (const Vector& coefs) const
{
if (coefs.size() == this->getNoProjectionNodes())
return new LRSplineField2D(projBasis.get(),coefs);
std::cerr <<" *** ASMu2D::getProjectedFields: Non-matching coefficent array,"
<<" size="<< coefs.size() <<" nnod="<< this->getNoProjectionNodes()
<< std::endl;
return nullptr;
}
Fields* ASMu2D::getProjectedFields (const Vector& coefs, size_t) const
{
if (projBasis.get() == this->getBasis(1))

View File

@ -413,6 +413,10 @@ public:
//! \brief Checks if a separate projection basis is used for this patch.
virtual bool separateProjectionBasis() const;
//! \brief Returns a field using the projection basis.
//! \param[in] coefs The coefficients for the field
virtual Field* getProjectedField(const Vector& coefs) const;
//! \brief Returns a field using the projection basis.
//! \param[in] coefs The coefficients for the field
virtual Fields* getProjectedFields(const Vector& coefs, size_t = 0) const;

View File

@ -1210,8 +1210,8 @@ void ASMu2Dmx::storeMesh (const std::string& fName, int fType) const
}
void ASMu2Dmx::copyRefinement(LR::LRSplineSurface* basis,
int multiplicity) const
void ASMu2Dmx::copyRefinement (LR::LRSplineSurface* basis,
int multiplicity) const
{
for (const LR::Meshline* line : refBasis->getAllMeshlines()) {
int mult = line->multiplicity_ > 1 ? line->multiplicity_ : multiplicity;

View File

@ -26,6 +26,7 @@
#include "CoordinateMapping.h"
#include "GaussQuadrature.h"
#include "LagrangeInterpolator.h"
#include "LRSplineField3D.h"
#include "LRSplineFields3D.h"
#include "ElementBlock.h"
#include "MPC.h"
@ -2119,6 +2120,18 @@ bool ASMu3D::separateProjectionBasis () const
}
Field* ASMu3D::getProjectedField (const Vector& coefs) const
{
if (coefs.size() == this->getNoProjectionNodes())
return new LRSplineField3D(projBasis.get(),coefs);
std::cerr <<" *** ASMu3D::getProjectedFields: Non-matching coefficent array,"
<<" size="<< coefs.size() <<" nnod="<< this->getNoProjectionNodes()
<< std::endl;
return nullptr;
}
Fields* ASMu3D::getProjectedFields (const Vector& coefs, size_t) const
{
if (projBasis.get() == this->getBasis(1))

View File

@ -404,6 +404,10 @@ public:
//! \brief Checks if a separate projection basis is used for this patch.
virtual bool separateProjectionBasis() const;
//! \brief Returns a field using the projection basis.
//! \param[in] coefs The coefficients for the field
virtual Field* getProjectedField(const Vector& coefs) const;
//! \brief Returns a field using the projection basis.
//! \param[in] coefs The coefficients for the field
virtual Fields* getProjectedFields(const Vector& coefs, size_t = 0) const;