Skip to content
Snippets Groups Projects
Commit 600f04a6 authored by Adrien Crovato's avatar Adrien Crovato
Browse files

Revert MshDeform::msh to public (easier)

parent fc276727
No related branches found
No related tags found
1 merge request!6amfe v1.0.5
Pipeline #5471 passed
...@@ -142,6 +142,7 @@ namespace std { ...@@ -142,6 +142,7 @@ namespace std {
%include "wGroups.h" %include "wGroups.h"
%warnfilter(+509); %warnfilter(+509);
%shared_ptr(tbox::MshDeform); %shared_ptr(tbox::MshDeform);
%immutable tbox::MshDeform::msh; // read-only variable (no setter)
%include "wMshDeform.h" // included after std templates because it needs them %include "wMshDeform.h" // included after std templates because it needs them
%shared_ptr(tbox::MshCrack); %shared_ptr(tbox::MshCrack);
%include "wMshCrack.h" %include "wMshCrack.h"
......
...@@ -32,9 +32,10 @@ using namespace tbox; ...@@ -32,9 +32,10 @@ using namespace tbox;
MshDeform::MshDeform(std::shared_ptr<MshData> _msh, MshDeform::MshDeform(std::shared_ptr<MshData> _msh,
std::shared_ptr<tbox::LinearSolver> _linsol, std::shared_ptr<tbox::LinearSolver> _linsol,
int _nDim, int nthrds) : wSharedObject(), msh(_msh), linsol(_linsol), int _nDim, int nthrds) : wSharedObject(), linsol(_linsol),
nDim(_nDim), nthreads(nthrds), nDim(_nDim), nthreads(nthrds),
field(false), fixed(false), moving(false) field(false), fixed(false),
moving(false), msh(_msh)
{ {
// Check problem dimension // Check problem dimension
if (nDim != 2 && nDim != 3) if (nDim != 2 && nDim != 3)
......
...@@ -34,7 +34,6 @@ namespace tbox ...@@ -34,7 +34,6 @@ namespace tbox
class TBOX_API MshDeform : public fwk::wSharedObject class TBOX_API MshDeform : public fwk::wSharedObject
{ {
private: private:
std::shared_ptr<MshData> msh; ///< mesh
std::shared_ptr<tbox::LinearSolver> linsol; ///< linear (inner) solver std::shared_ptr<tbox::LinearSolver> linsol; ///< linear (inner) solver
size_t mshSize; ///< number of nodes in the mesh size_t mshSize; ///< number of nodes in the mesh
int nDim; ///< dimension of the problem (2 or 3) int nDim; ///< dimension of the problem (2 or 3)
...@@ -63,6 +62,8 @@ private: ...@@ -63,6 +62,8 @@ private:
Eigen::MatrixXd buildK(tbox::Element const &e, Eigen::MatrixXd const &H); Eigen::MatrixXd buildK(tbox::Element const &e, Eigen::MatrixXd const &H);
public: public:
std::shared_ptr<MshData> msh; ///< mesh
MshDeform(std::shared_ptr<MshData> _msh, std::shared_ptr<tbox::LinearSolver> _linsol, int _nDim, int nthrds = 1); MshDeform(std::shared_ptr<MshData> _msh, std::shared_ptr<tbox::LinearSolver> _linsol, int _nDim, int nthrds = 1);
virtual ~MshDeform() { std::cout << "~MshDeform()\n"; } virtual ~MshDeform() { std::cout << "~MshDeform()\n"; }
......
...@@ -78,10 +78,10 @@ void UnitTest::gmshIO(GmshExport *writer, GmshImport *reader) ...@@ -78,10 +78,10 @@ void UnitTest::gmshIO(GmshExport *writer, GmshImport *reader)
/** /**
* @brief Deform a mesh of dimension d * @brief Deform a mesh of dimension d
*/ */
void UnitTest::mshDeform(MshData *msh, MshDeform *mshDef, int d) void UnitTest::mshDeform(MshDeform *mshDef, int d)
{ {
// Initialize memory (volume element only) // Initialize memory (volume element only)
for (auto e : msh->elems) for (auto e : mshDef->msh->elems)
if ((d == 2 && e->type() == ELTYPE::TRI3) || (d == 3 && e->type() == ELTYPE::TETRA4)) if ((d == 2 && e->type() == ELTYPE::TRI3) || (d == 3 && e->type() == ELTYPE::TETRA4))
e->initValues(true); e->initValues(true);
// Call deform // Call deform
......
...@@ -36,7 +36,7 @@ public: ...@@ -36,7 +36,7 @@ public:
virtual ~UnitTest() {} virtual ~UnitTest() {}
void gmshIO(GmshExport *writer, GmshImport *reader); void gmshIO(GmshExport *writer, GmshImport *reader);
void mshDeform(MshData *msh, MshDeform *mshDef, int d); void mshDeform(MshDeform *mshDef, int d);
}; };
} // namespace tbox } // namespace tbox
......
...@@ -55,7 +55,7 @@ def main(): ...@@ -55,7 +55,7 @@ def main():
# deform the mesh # deform the mesh
test = tbox.UnitTest() test = tbox.UnitTest()
tms["deform"].start() tms["deform"].start()
test.mshDeform(msh, mshDef, 2) test.mshDeform(mshDef, 2)
tms["deform"].stop() tms["deform"].stop()
gmshWriter.save("beam_def") gmshWriter.save("beam_def")
......
...@@ -54,7 +54,7 @@ def main(): ...@@ -54,7 +54,7 @@ def main():
# deform the mesh # deform the mesh
test = tbox.UnitTest() test = tbox.UnitTest()
tms["deform"].start() tms["deform"].start()
test.mshDeform(msh, mshDef, 3) test.mshDeform(mshDef, 3)
tms["deform"].stop() tms["deform"].stop()
gmshWriter.save(msh.name+"_def") gmshWriter.save(msh.name+"_def")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment