Commit 261983db by Bertrand Thierry

Merge branch 'master' into matlab

parents cf49c215 853328f4
Pipeline #1052 passed with stage
in 24 minutes 3 seconds
......@@ -25,9 +25,9 @@ stero mode), Ashish Negi (Netgen CAD healing), Trevor Strickler
Benjamin Ruard (Java wrappers), Maxime Graulich (iOS/Android port), Francois
Henrotte (onelab metamodels), Sebastian Eiser (PGF output), Alexis Salzman
(compressed IO), Hang Si (TetGen/BR boundary recovery code), Fernando Lorenzo
(Tochnog support), Anthony Royer (new partitioning code, MSH4 format). See
comments in the sources for more information. If we forgot to list your
contributions please send us an email!
(Tochnog support), Larry Price (Gambit export), Anthony Royer (new partitioning
code, MSH4 format). See comments in the sources for more information. If we
forgot to list your contributions please send us an email!
The TetGen/BR code (Mesh/tetgenBR.{cpp,h}) is copyright (c) 2016 Hang Si,
Weierstrass Institute for Applied Analysis and Stochatics.
......@@ -156,4 +156,4 @@ Hackbarth, Peter Wainwright, Jiri Hnidek, Thierry Thomas, Konstantinos Poulios,
Laurent Van Miegroet, Shahrokh Ghavamian, Geordie McBain, Jose Paulo Moitinho de
Almeida, Guillaume Demesy, Wendy Merks-Swolfs, Cosmin Stefan Deaconu, Nigel
Nunn, Serban Georgescu, Julien Troufflard, Michele Mocciola, Matthijs Sypkens
Smit, Sauli Ruuska, Larry Price.
Smit, Sauli Ruuska.
......@@ -2,6 +2,8 @@
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to the public mailing list <gmsh@onelab.info>.
//
// Contributed by Larry Price
#include <time.h>
#include <algorithm>
......@@ -18,9 +20,9 @@
namespace
{
static const unsigned GAMBIT_TYPE_EDGE = 1;
static const unsigned GAMBIT_TYPE_QUAD = 2;
static const unsigned GAMBIT_TYPE_TRI = 3;
//static const unsigned GAMBIT_TYPE_EDGE = 1;
//static const unsigned GAMBIT_TYPE_QUAD = 2;
//static const unsigned GAMBIT_TYPE_TRI = 3;
static const unsigned GAMBIT_TYPE_TET = 6;
// This struct allows us to take advantage of C++11 unordered_map while
......
......@@ -1267,19 +1267,6 @@ static void CreateNewEntities(GModel *const model,
}
template <class ITERATOR>
static void fillit_(hashmapface &faceToElement,
const std::vector<unsigned int> &partitions,
ITERATOR it_beg, ITERATOR it_end)
{
for (ITERATOR it = it_beg; it != it_end ; ++it){
for(int i = 0; i < (*it)->getNumFaces(); i++){
faceToElement[(*it)->getFace(i)].push_back
(std::pair<MElement*, std::vector<unsigned int> >(*it, partitions));
}
}
}
template <class ITERATOR>
static void fillit_(hashmapedge &edgeToElement,
const std::vector<unsigned int> &partitions,
ITERATOR it_beg, ITERATOR it_end)
......@@ -1645,19 +1632,12 @@ static void CreatePartitionBoundaries(GModel *const model,
if (meshDim >= 3){ // Create partition faces
Msg::Info(" - Creating partition faces");
for(GModel::const_riter it = model->firstRegion(); it != model->lastRegion(); ++it){
if((*it)->geomType() == GEntity::PartitionVolume){
// FIXME: this is slow
fillit_(faceToElement, static_cast<partitionRegion*>(*it)->getPartitions(),
(*it)->tetrahedra.begin(), (*it)->tetrahedra.end());
fillit_(faceToElement, static_cast<partitionRegion*>(*it)->getPartitions(),
(*it)->hexahedra.begin(), (*it)->hexahedra.end());
fillit_(faceToElement, static_cast<partitionRegion*>(*it)->getPartitions(),
(*it)->prisms.begin(), (*it)->prisms.end());
fillit_(faceToElement, static_cast<partitionRegion*>(*it)->getPartitions(),
(*it)->pyramids.begin(), (*it)->pyramids.end());
fillit_(faceToElement, static_cast<partitionRegion*>(*it)->getPartitions(),
(*it)->trihedra.begin(), (*it)->trihedra.end());
for(unsigned int i = 0; i < boundaryElements.size(); i++){
for(std::set<MElement*>::iterator it = boundaryElements[i].begin(); it != boundaryElements[i].end(); ++it){
for(int j = 0; j < (*it)->getNumFaces(); j++){
faceToElement[(*it)->getFace(j)].push_back
(std::pair<MElement*, std::vector<unsigned int> >(*it, std::vector<unsigned int>(1,i)));
}
}
}
......@@ -1744,12 +1724,26 @@ static void CreatePartitionBoundaries(GModel *const model,
if (meshDim >= 2){ // Create partition edges
Msg::Info(" - Creating partition edges");
for(GModel::const_fiter it = model->firstFace(); it != model->lastFace(); ++it){
if((*it)->geomType() == GEntity::PartitionSurface){
fillit_(edgeToElement, static_cast<partitionFace*>(*it)->getPartitions(),
(*it)->triangles.begin(), (*it)->triangles.end());
fillit_(edgeToElement, static_cast<partitionFace*>(*it)->getPartitions(),
(*it)->quadrangles.begin(), (*it)->quadrangles.end());
if (meshDim == 2){
for(unsigned int i = 0; i < boundaryElements.size(); i++){
for(std::set<MElement*>::iterator it = boundaryElements[i].begin();
it != boundaryElements[i].end(); ++it){
for(int j = 0; j < (*it)->getNumEdges(); j++){
edgeToElement[(*it)->getEdge(j)].push_back
(std::pair<MElement*, std::vector<unsigned int> >
(*it, std::vector<unsigned int>(1,i)));
}
}
}
}
else{
for(GModel::const_fiter it = model->firstFace(); it != model->lastFace(); ++it){
if((*it)->geomType() == GEntity::PartitionSurface){
fillit_(edgeToElement, static_cast<partitionFace*>(*it)->getPartitions(),
(*it)->triangles.begin(), (*it)->triangles.end());
fillit_(edgeToElement, static_cast<partitionFace*>(*it)->getPartitions(),
(*it)->quadrangles.begin(), (*it)->quadrangles.end());
}
}
}
for(hashmapedge::const_iterator it = edgeToElement.begin();
......@@ -1831,10 +1825,24 @@ static void CreatePartitionBoundaries(GModel *const model,
if (meshDim >= 1){ // Create partition vertices
Msg::Info(" - Creating partition vertices");
for(GModel::const_eiter it = model->firstEdge(); it != model->lastEdge(); ++it){
if((*it)->geomType() == GEntity::PartitionCurve){
fillit_(vertexToElement, static_cast<partitionEdge*>(*it)->getPartitions(),
(*it)->lines.begin(), (*it)->lines.end());
if (meshDim == 1){
for(unsigned int i = 0; i < boundaryElements.size(); i++){
for(std::set<MElement*>::iterator it = boundaryElements[i].begin();
it != boundaryElements[i].end(); ++it){
for(int j = 0; j < (*it)->getNumPrimaryVertices(); j++){
vertexToElement[(*it)->getVertex(j)].push_back
(std::pair<MElement*, std::vector<unsigned int> >
(*it, std::vector<unsigned int>(1,i)));
}
}
}
}
else{
for(GModel::const_eiter it = model->firstEdge(); it != model->lastEdge(); ++it){
if((*it)->geomType() == GEntity::PartitionCurve){
fillit_(vertexToElement, static_cast<partitionEdge*>(*it)->getPartitions(),
(*it)->lines.begin(), (*it)->lines.end());
}
}
}
for(hashmapvertex::const_iterator it = vertexToElement.begin();
......
Point(1) = {0,0,0};
Point(2) = {1,0,0};
Point(3) = {1,1,0};
Point(4) = {0,1,0};
Line(1) = {1,2};
Line(2) = {2,3};
Line(3) = {3,4};
Line(4) = {4,1};
Line Loop(5) = {1,2,3,4};
Plane Surface(6) = {5};
// computes the distance to point 1
Field[1] = Distance;
Field[1].NodesList = {1};
// computes a function of the value computed by field 1 ("F1")
Field[2] = MathEval;
Field[2].F = "Exp(-7*(1-F1))";
// applies field 2 as background mesh
Background Field = 2;
SetFactory("OpenCASCADE");
a() = ShapeFromFile("cube-sphere-cube-compound.brep");
//Recursive Delete{ Volume{1,3}; }
BooleanFragments{ Volume{a()}; Delete; }{}
//Save "bb.step";
SetFactory("OpenCASCADE");
Mesh.CharacteristicLengthMin = 0.4;
Mesh.CharacteristicLengthMax = 0.4;
Circle(1) = {0,0,0, 2, Pi};
Circle(2) = {0,0,0, 2, Pi, 2*Pi};
Extrude{0,0,10}{ Line{1,2}; }
Cylinder(2) = {0, 0, 5, 0, 10, 0, 1, 2*Pi};
BooleanDifference{ Surface{1,2}; Delete; }{ Volume{2}; Delete; }
Rectangle(9) = {0, 0, 4, 4, 1, 0};
Rotate {{1, 0, 0}, {0, 0, 4}, Pi/2} {Surface{9};}
Rotate {{0, 0, 1}, {0, 0, 4}, Pi/6} {Surface{9};}
BooleanFragments{ Surface{1,9}; Delete; }{}
SetFactory("Built-in");
p1 = newp;
Point(p1) = { 0, 0, 0.0, 1 };
p2 = newp;
Point(p2) = { 10, 0, 0.0, 2 };
l1 = newl;
Line(l1) = { p1, p2 };
s1 = news;
out[] = Extrude { 0, 15, 0} {Line{ l1 };};
s1 = out[1];
Color Yellow { Surface{ s1 }; }
View "comments" {T3(2, 18, 0, TextAttributes("Align", "Center", "Font", "Helvetica")){ "Built-in" };};
SetFactory("OpenCASCADE");
p3 = newp;
Point(p3) = { 15, 0, 0.0, 1 };
p4 = newp;
Point(p4) = { 25, 0, 0.0, 2 };
l2 = newl;
Line(l2) = { p3, p4 };
s2 = news;
out[] = Extrude { 0, 15, 0} {Line{ l2 };};
s2 = out[1];
Color LightYellow { Surface{ s2 }; }
View "comments" {T3(20, 18, 0, TextAttributes("Align", "Center", "Font", "Helvetica")){ "OpenCASCADE" };};
//Mesh 2;
SetFactory("OpenCASCADE");
a() = ShapeFromFile("mesh_T106_V3.step");
b() = BooleanFragments{ Surface{a()}; Delete; }{};
Surface Loop(1) = {b()};
Volume(1) = {1};
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment