Skip to content
Snippets Groups Projects
Commit c4966acf authored by Maximilien Siavelis's avatar Maximilien Siavelis
Browse files

new plugin to generate faultzone

parent 34f2e5fc
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@ set(SRC
CutMesh.cpp
NewView.cpp
SimplePartition.cpp Crack.cpp
FaultZone.cpp
)
file(GLOB HDR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h)
......
This diff is collapsed.
// Gmsh - Copyright (C) 1997-2013 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to the public mailing list <gmsh@geuz.org>.
#ifndef _MESH_FAULTZONE_H_
#define _MESH_FAULTZONE_H_
#include <assert.h>
#include "Plugin.h"
class SVector3;
class GEdge;
class GFace;
class MVertex;
class MElement;
extern "C"
{
GMSH_Plugin *GMSH_RegisterFaultZonePlugin();
}
class GMSH_FaultZonePlugin : public GMSH_PostPlugin{
public:
GMSH_FaultZonePlugin(){}
std::string getName() const { return "FaultZone"; }
std::string getShortHelp() const{ return "FaultZone generator"; }
std::string getHelp() const;
int getNbOptions() const;
StringXNumber* getOption(int iopt);
int getNbOptionsStr() const;
StringXString *getOptionStr(int iopt);
PView* execute(PView*);
};
//=============================================================================
/*!
* \brief This class creates joint elements over the embedded edges of a GFace
*/
//=============================================================================
class GMSH_FaultZoneMesher{
public:
GMSH_FaultZoneMesher(){}
void RetriveFissuresInfos(GFace* gFace);
void DuplicateNodes();
void ComputeHeavisideFunction();
void CreateJointElements(GModel* gModel, GFace* gFace, const std::string prefix);
void ModifyElementsConnectivity(GFace* gFace);
void ModifyJointNodePosition(const double eps);
private:
std::set < MElement* > _jointElements;
std::map < GEdge* , SVector3 > _vectNormByFissure;
std::map < MVertex* , GEdge* > _fissureByHeavNode;
std::map < MVertex* , std::vector < GEdge* > > _fissuresByJunctionNode;
std::map < MVertex* , std::vector < SVector3 > > _vectsTanByJunctionNode;
std::set < MElement* > _connectedElements;
typedef std::set<MElement*>::iterator elementsIt;
static const SVector3 vectZ;
std::map < MVertex* , SVector3 > _vectsTanByTipNode;
std::map < MVertex*, MVertex* > _nodeByHeavNode;
std::map < MVertex*, MVertex* > _nodeJointByHeavOrJunctionNode;
std::map < MVertex*, std::vector < MVertex*> > _nodesByJunctionNode;
std::map < MVertex*, std::vector <std::vector< int > > > _heavFuncByJunctionNode;
std::vector < int > HeavisideFunc(MVertex* mVert, SPoint3& sPoint);
static const int _numNodeHeavInf[3];
static const int _numNodeHeavSup[3];
static const int _numNodeJoint[2];
};
//=============================================================================
/*!
* \brief Compare two heaviside functions
*/
//=============================================================================
inline bool compareHeav(const std::vector< int > heav1, const std::vector< int > heav2){
assert(heav1.size() >= heav2.size());
for (unsigned int i=0; i< heav2.size(); i++){
if (heav1[i] != 0 and heav1[i] != heav2[i] and heav2[i] != 0){
return false;
}
}
return true;
}
//=============================================================================
/*!
* \brief Find the matching heaviside function heav, in the vector heavFunc
*/
//=============================================================================
inline int findMatchingHeav(const std::vector< std::vector < int > >& heavFunc, const std::vector< int >& heav){
for (unsigned int i=0; i < heavFunc.size();i++){
if(compareHeav(heavFunc[i], heav))
return i;
}
assert(false);
}
#endif
......@@ -58,6 +58,7 @@
#include "Scal2Vec.h"
#include "CutMesh.h"
#include "NewView.h"
#include "FaultZone.h"
// for testing purposes only :-)
#undef HAVE_DLOPEN
......@@ -248,6 +249,8 @@ void PluginManager::registerDefaultPlugins()
("SimplePartition", GMSH_RegisterSimplePartitionPlugin()));
allPlugins.insert(std::pair<std::string, GMSH_Plugin*>
("Crack", GMSH_RegisterCrackPlugin()));
allPlugins.insert(std::pair<std::string, GMSH_Plugin*>
("FaultZone", GMSH_RegisterFaultZonePlugin()));
#if defined(HAVE_TETGEN)
allPlugins.insert(std::pair<std::string, GMSH_Plugin*>
("Tetrahedralize", GMSH_RegisterTetrahedralizePlugin()));
......
Mesh.ElementOrder = 2;
Mesh.CharacteristicLengthFactor = 0.1;
Mesh.RecombinationAlgorithm = 0;
Mesh.SecondOrderIncomplete = 1;
Point(1) = {-10,-8,0.000000};
Point(2) = {4, 6,0.000000};
Point(3) = {-11,-4,0.000000};
Point(4) = {-3, 4,0.000000};
Point(5) = {0,-7,0.000000};
Point(6) = {10, 3,0.000000};
Point(7) = {-8,-9,0.000000};
Point(8) = {3,2,0.000000};
Point(9) = {0,-9,0.000000};
Point(10)= {4,-5,0.000000};
Point(11) = {-9,-9,0.000000};
Point(12) = { 6,-9,0.000000};
Point(13) = { 1,-5 ,0.000000};
Point(14) = {11,-5 ,0.000000};
Point(15) = {-13, 0 ,0.000000};
Point(16) = { 3, 0 ,0.000000};
Point(17) = {-6 ,5 ,.000000};
Point(18) = {9 ,5 ,.000000};
Point(19) = {-4 ,9 ,.000000};
Point(20) = {4 ,9 ,.000000};
Line(1) = {1,2};
Line(2) = {3,4};
Line(3) = {5,6};
Line(4) = {7,8};
Line(5) = {9,10};
Line(6) = {11,12};
Line(7) = {13,14};
Line(8) = {15,16};
Line(9) = {17,18};
Line(10)= {19,20};
Point(288) = {-12.941176,-10.000000,0.000000};
Point(289) = {-12.941176,0.000000,0.000000};
Point(290) = {-12.941176,10.000000,0.000000};
Point(286) = {12.941176,10.000000,0.000000};
Point(287) = {12.941176,-10.000000,0.000000};
Line(145) = {286,287};
Line(146) = {287,288};
Line(147) = {288,289};
Line(148) = {289,290};
Line(149) = {290,286};
Line Loop(150) = {145,146,147,148,149};
Plane Surface(1) = {150};
group1[] = {1, 2, 3, 4, 5};
group2[] = {6, 7, 8, 9,10};
Physical Line ( 1 ) = { group1[] } ;
Physical Line ( 2 ) = { group2[] } ;
Physical Line ( "DROITE" ) = { 145 } ;
Physical Line ( "BAS" ) = { 146 } ;
Physical Line ( "GAUCHE" ) = { 147, 148 } ;
Physical Line ( "HAUT" ) = { 149 } ;
Physical Surface ( "MASSIF" ) = { 1 } ;
Line { group1[] } In Surface {1};
Line { group2[] } In Surface {1};
Mesh 2;
Plugin(FaultZone).SurfaceTag = 1;
Plugin(FaultZone).Thickness = 0.05;
Plugin(FaultZone).Prefix = "FAMI_";
Plugin(FaultZone).Run;
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