added: write methods to ASMxDLag/Tri

(mainly) used for storing the FEM models in HDF5
This commit is contained in:
Arne Morten Kvarving 2020-07-10 14:49:05 +02:00
parent 310f8c5494
commit 15daa0ae92
10 changed files with 54 additions and 0 deletions

View File

@ -1457,3 +1457,18 @@ bool ASMbase::evaluate (const FunctionBase*, RealArray&, int, double) const
{
return Aerror("evaluate(const FunctionBase*,RealArray&,int,double)");
}
bool ASMbase::writeLagBasis (std::ostream& os, const char* type) const
{
os << "# LAGRANGIAN nodes=" << this->getNoNodes()
<< " elements=" << this->getNoElms()
<< " type=" << type << "\n";
for (size_t i = 1; i <= this->getNoNodes(); ++i)
os << this->getCoord(i) << "\n";
for (const IntVec& mnpc : MNPC)
for (size_t i = 0; i < mnpc.size(); ++i)
os << mnpc[i] << (i+1 == mnpc.size() ? '\n' : ' ');
return true;
}

View File

@ -811,6 +811,9 @@ protected:
//! is changed into the number of the other node.
static bool collapseNodes(ASMbase& pch1, int node1, ASMbase& pch2, int node2);
//! \brief Write a lagrangian basis to given stream.
bool writeLagBasis(std::ostream& os, const char* type) const;
public:
static bool fixHomogeneousDirichlet; //!< If \e true, pre-eliminate fixed DOFs

View File

@ -554,3 +554,9 @@ bool ASMs1DLag::evalSolution (Matrix& sField, const IntegrandBase& integrand,
return true;
}
bool ASMs1DLag::write(std::ostream& os, int) const
{
return this->writeLagBasis(os, "line");
}

View File

@ -39,6 +39,9 @@ public:
// Methods for model generation
// ============================
//! \brief Writes the FEM basis to given stream.
virtual bool write(std::ostream& os, int = 0) const;
//! \brief Generates a beam finite element model for the patch.
//! \param[in] Zaxis Vector defining a point in the local XZ-plane
virtual bool generateOrientedFEModel(const Vec3& Zaxis);

View File

@ -765,3 +765,9 @@ void ASMs2DLag::generateThreadGroups (const Integrand&, bool, bool)
{
threadGroups.calcGroups((nx-1)/(p1-1),(ny-1)/(p2-1),1);
}
bool ASMs2DLag::write(std::ostream& os, int) const
{
return this->writeLagBasis(os, "quad");
}

View File

@ -39,6 +39,9 @@ public:
// Methods for model generation
// ============================
//! \brief Writes the FEM basis to given stream.
virtual bool write(std::ostream& os, int = 0) const;
//! \brief Generates the finite element topology data for the patch.
//! \details The data generated are the element-to-node connectivity array,
//! the nodal coordinate array, as well as global node and element numbers.

View File

@ -597,3 +597,9 @@ void ASMs2DTri::generateThreadGroups (const Integrand&, bool, bool)
#endif
}
}
bool ASMs2DTri::write(std::ostream& os, int) const
{
return this->writeLagBasis(os, "triangle");
}

View File

@ -38,6 +38,9 @@ public:
// Methods for model generation
// ============================
//! \brief Writes the FEM basis to given stream.
virtual bool write(std::ostream& os, int = 0) const;
//! \brief Generates the finite element topology data for the patch.
//! \details The data generated are the element-to-node connectivity array,
//! the nodal coordinate array, as well as global node and element numbers.

View File

@ -1090,3 +1090,9 @@ bool ASMs3DLag::getGridParameters (RealArray& prm, int dir, int nSegPerSpan) con
return true;
}
bool ASMs3DLag::write(std::ostream& os, int) const
{
return this->writeLagBasis(os, "hexahedron");
}

View File

@ -39,6 +39,9 @@ public:
// Methods for model generation
// ============================
//! \brief Writes the FEM basis to given stream.
virtual bool write(std::ostream& os, int = 0) const;
//! \brief Generates the finite element topology data for the patch.
//! \details The data generated are the element-to-node connectivity array,
//! the nodal coordinate array, as well as global node and element numbers.