diff --git a/src/ASM/IntegrandBase.C b/src/ASM/IntegrandBase.C index 0540e67d..92c25040 100644 --- a/src/ASM/IntegrandBase.C +++ b/src/ASM/IntegrandBase.C @@ -302,6 +302,9 @@ bool NormBase::initElement (const std::vector& MNPC, bool NormBase::initElementBou (const std::vector& 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& MNPC, const std::vector& 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; } diff --git a/src/ASM/IntegrandBase.h b/src/ASM/IntegrandBase.h index de52ddb7..14cab23c 100644 --- a/src/ASM/IntegrandBase.h +++ b/src/ASM/IntegrandBase.h @@ -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