Added: Option to use projected solution for boundary integrands.

Fixed: Be more forgiving on the length of the norm prefix.
This commit is contained in:
Knut Morten Okstad 2017-04-30 02:16:35 +02:00
parent 0b0a365b38
commit d108607d35
2 changed files with 16 additions and 17 deletions

View File

@ -302,6 +302,9 @@ bool NormBase::initElement (const std::vector<int>& MNPC,
bool NormBase::initElementBou (const std::vector<int>& MNPC,
LocalIntegral& elmInt)
{
if (projBou && !this->initProjection(MNPC,elmInt))
return false;
return myProblem.initElementBou(MNPC,elmInt);
}
@ -311,6 +314,9 @@ bool NormBase::initElementBou (const std::vector<int>& MNPC,
const std::vector<size_t>& basis_sizes,
LocalIntegral& elmInt)
{
if (projBou && !this->initProjection(MNPC,elmInt))
return false;
return myProblem.initElementBou(MNPC,elem_sizes,basis_sizes,elmInt);
}
@ -319,18 +325,9 @@ std::string NormBase::getName (size_t i, size_t j, const char* prefix) const
{
char comp[32];
sprintf(comp,"norm_%lu.%lu",i,j);
if (prefix)
{
std::string tmp(comp);
if (strlen(prefix)+1+tmp.size() < sizeof(comp))
strcpy(comp,prefix);
else
strncpy(comp,prefix,sizeof(comp)-1-tmp.size());
strcat(comp," ");
strcat(comp,tmp.c_str());
}
if (!prefix) return comp;
return comp;
return prefix + std::string(" ") + comp;
}

View File

@ -208,12 +208,13 @@ public:
virtual bool diverged(size_t = 0) const { return false; }
//! \brief Returns a pointer to an Integrand for solution norm evaluation.
virtual NormBase* getNormIntegrand(AnaSol* = 0) const { return 0; }
virtual NormBase* getNormIntegrand(AnaSol* = nullptr) const
{ return nullptr; }
//! \brief Returns a pointer to an Integrand for boundary force evaluation.
virtual ForceBase* getForceIntegrand(const Vec3*, AnaSol* = 0) const
{ return 0; }
virtual ForceBase* getForceIntegrand(const Vec3*, AnaSol* = nullptr) const
{ return nullptr; }
//! \brief Returns a pointer to an Integrand for nodal force evaluation.
virtual ForceBase* getForceIntegrand() const { return 0; }
virtual ForceBase* getForceIntegrand() const { return nullptr; }
//! \brief Returns the number of spatial dimensions.
size_t getNoSpaceDim() const { return nsd; }
@ -284,8 +285,8 @@ class NormBase : public Integrand
{
protected:
//! \brief The default constructor is protected to allow sub-classes only.
NormBase(IntegrandBase& p) : myProblem(p), nrcmp(0), lints(0),
finalOp(ASM::SQRT) {}
NormBase(IntegrandBase& p) : myProblem(p), projBou(false), nrcmp(0),
lints(nullptr), finalOp(ASM::SQRT) {}
public:
//! \brief Empty destructor.
@ -370,6 +371,7 @@ protected:
IntegrandBase& myProblem; //!< The problem-specific data
Vectors prjsol; //!< Projected secondary solution vectors for current patch
bool projBou; //!< If \e true, the boundary integrand needs prjsol too
unsigned short int nrcmp; //!< Number of projected solution components
LintegralVec* lints; //!< Local integrals used during norm integration