From d9c6bddcf96e282052300313b9a060177d96894c Mon Sep 17 00:00:00 2001 From: Nicolas Marsic <nicolas.marsic@gmail.com> Date: Thu, 9 Aug 2012 13:42:19 +0000 Subject: [PATCH] Mesh v2 -- OK --- FunctionSpace/BasisTest.cpp | 9 ++++++--- FunctionSpace/FunctionSpace.cpp | 18 +++++++++++------- FunctionSpace/FunctionSpace.h | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/FunctionSpace/BasisTest.cpp b/FunctionSpace/BasisTest.cpp index 24cebdb535..8723e2538c 100644 --- a/FunctionSpace/BasisTest.cpp +++ b/FunctionSpace/BasisTest.cpp @@ -1,6 +1,8 @@ #include <iostream> -#include "Mesh.h" + #include "Gmsh.h" +#include "Mesh.h" +#include "GroupOfElement.h" #include "QuadNodeBasis.h" #include "QuadEdgeBasis.h" @@ -23,15 +25,16 @@ int ain(int argc, char** argv){ // Get Mesh // Mesh msh(argv[1]); + GroupOfElement goe = msh.getFromPhysical(7); // Writer for .msh WriterMsh writer; - writer.setDomain(msh.getGroup(2).getAll()); + writer.setDomain(goe.getAll()); // Plot Basis // HexNodeBasis b(1); - PlotBasis plot(msh.getGroup(2), b, writer); + PlotBasis plot(goe, b, writer); plot.plot("basis"); // Stop Gmsh // diff --git a/FunctionSpace/FunctionSpace.cpp b/FunctionSpace/FunctionSpace.cpp index ddfc234522..13fb8ec94a 100644 --- a/FunctionSpace/FunctionSpace.cpp +++ b/FunctionSpace/FunctionSpace.cpp @@ -3,17 +3,21 @@ using namespace std; -FunctionSpace::FunctionSpace(const GroupOfElement& goe, int basisType, int order){ +FunctionSpace::FunctionSpace(const GroupOfElement& goe, Mesh& mesh, + int basisType, int order){ // Save GroupOfElement & Mesh // this->goe = &goe; - this->mesh = &(goe.getMesh()); + this->mesh = &mesh; // Get Geo Data (WARNING HOMOGENE MESH REQUIRED)// - MElement& element = goe.get(0); - int elementType = element.getType(); - int nVertex = element.getNumVertices(); - int nEdge = element.getNumEdges(); - int nFace = element.getNumFaces(); + const MElement& element = goe.get(0); + MElement& myElement = + const_cast<MElement&>(element); + + int elementType = myElement.getType(); + int nVertex = myElement.getNumVertices(); + int nEdge = myElement.getNumEdges(); + int nFace = myElement.getNumFaces(); // Init Struct // type = basisType; diff --git a/FunctionSpace/FunctionSpace.h b/FunctionSpace/FunctionSpace.h index 8f2adadacd..91bf93d3ef 100644 --- a/FunctionSpace/FunctionSpace.h +++ b/FunctionSpace/FunctionSpace.h @@ -37,7 +37,7 @@ class FunctionSpace{ int type; public: - FunctionSpace(const GroupOfElement& goe, + FunctionSpace(const GroupOfElement& goe, Mesh& mesh, int basisType, int order); virtual ~FunctionSpace(void); -- GitLab