Refactor: Moved "nsd" variable and evalSol function to IntegrandBase

This commit is contained in:
Kjetil Andre Johannessen
2015-06-24 11:19:44 +02:00
committed by Knut Morten Okstad
parent 411ba53495
commit ec482d4ff7
3 changed files with 13 additions and 7 deletions

View File

@@ -147,21 +147,24 @@ bool IntegrandBase::evalSol (Vector& s, const MxFiniteElement& fe,
}
bool IntegrandBase::evalSol (Vector&, const TensorFunc&, const Vec3&) const
bool IntegrandBase::evalSol (Vector& s, const TensorFunc& asol, const Vec3& X) const
{
return Ierror("evalSol(Vector&,const TensorFunc&,const Vec3&)");
s = Vector(asol(X).ptr(),nsd);
return true;
}
bool IntegrandBase::evalSol (Vector&, const STensorFunc&, const Vec3&) const
bool IntegrandBase::evalSol (Vector& s, const STensorFunc& asol, const Vec3& X) const
{
return Ierror("evalSol(Vector&,const STensorFunc&,const Vec3&)");
s = Vector(asol(X).ptr(),nsd);
return true;
}
bool IntegrandBase::evalSol (Vector&, const VecFunc&, const Vec3&) const
bool IntegrandBase::evalSol (Vector& s, const VecFunc& asol, const Vec3& X) const
{
return Ierror("evalSol(Vector&,const VecFunc&,const Vec3&)");
s = Vector(asol(X).ptr(),nsd);
return true;
}

View File

@@ -213,6 +213,8 @@ public:
//! \brief Returns a pointer to an Integrand for nodal force evaluation.
virtual ForceBase* getForceIntegrand() const { return 0; }
//! \brief Returns number of spatial dimensions.
virtual size_t getNoSpaceDim() const { return nsd; }
//! \brief Returns the number of primary/secondary solution field components.
virtual size_t getNoFields(int = 2) const { return 0; }
@@ -261,6 +263,7 @@ private:
std::map<std::string,Vector*> myFields; //!< Named fields of this integrand
protected:
unsigned short int nsd; //!< Number of spatial dimensions (1,2 or, 3)
Vectors primsol; //!< Primary solution vectors for current patch
unsigned short int npv; //!< Number of primary solution variables per node
SIM::SolutionMode m_mode; //!< Current solution mode

View File

@@ -197,7 +197,7 @@ public:
//! \brief Returns the number of parameter dimensions in the model.
virtual unsigned short int getNoParamDim() const = 0;
//! \brief Returns the number of spatial dimensions in the model.
virtual size_t getNoSpaceDim() const { return nsd; }
size_t getNoSpaceDim() const { return nsd; }
//! \brief Returns the number of primary solution fields.
//! \param[in] basis Which basis to consider when mixed methods (0 = both)
size_t getNoFields(int basis = 0) const;