diff --git a/Common/GmshMessage.cpp b/Common/GmshMessage.cpp index 532f894c9973030544660c85b12d8bfca2e11c89..a9301703dfcea068d2f984d21050c3eab37f6e58 100644 --- a/Common/GmshMessage.cpp +++ b/Common/GmshMessage.cpp @@ -12,6 +12,7 @@ #include "GmshSocket.h" #include "onelab.h" #include "Gmsh.h" +#include "GModel.h" #include "Options.h" #include "Context.h" #include "OS.h" diff --git a/Fltk/onelabWindow.cpp b/Fltk/onelabWindow.cpp index 181bf3cf15f3e16eb9d5b3fd2adf2ffb202fbe6d..25309b653e79cd78921609494570498694b6608a 100644 --- a/Fltk/onelabWindow.cpp +++ b/Fltk/onelabWindow.cpp @@ -12,6 +12,8 @@ #include <FL/Fl_Check_Button.H> #include <FL/Fl_Box.H> #include "Context.h" +#include "GModel.h" +#include "GmshDefines.h" #include "Options.h" #include "OS.h" #include "StringUtils.h" diff --git a/Geo/GFace.cpp b/Geo/GFace.cpp index c3592f297c0dc4455853ca9e92962cedf2772ab7..f877f61eb271a507e48d1a278971c859401eaf6f 100644 --- a/Geo/GFace.cpp +++ b/Geo/GFace.cpp @@ -9,6 +9,7 @@ #include "GModel.h" #include "GFace.h" #include "GEdge.h" +#include "GFaceCompound.h" #include "GEdgeCompound.h" #include "MTriangle.h" #include "MQuadrangle.h" diff --git a/Geo/GFaceCompound.cpp b/Geo/GFaceCompound.cpp index 278273b0aaa6f73ec7e86bc05e2bee97d3b81d2f..1eb7f07e5f2c3db528331805d20b1e56ef7be4ff 100644 --- a/Geo/GFaceCompound.cpp +++ b/Geo/GFaceCompound.cpp @@ -8,13 +8,12 @@ // #include "GmshConfig.h" -#define SQU(a) ((a)*(a)) -#define CUB(a) ((a)*(a)*(a)) +#include "GmshDefines.h" +#include "GFaceCompound.h" +#include "GEdgeCompound.h" #if defined(HAVE_SOLVER) -#include "GmshDefines.h" -#include "GFaceCompound.h" #include "MLine.h" #include "MTriangle.h" #include "Numeric.h" @@ -25,7 +24,6 @@ #include "polynomialBasis.h" #include "robustPredicates.h" #include "MElementCut.h" -#include "GEntity.h" #include "dofManager.h" #include "laplaceTerm.h" #include "crossConfTerm.h" @@ -2251,3 +2249,22 @@ void GFaceCompound::printStuff(int iNewton) const } #endif + +void replaceMeshCompound(GFace *gf, std::list<GEdge*> &edges) +{ + std::list<GEdge*> e = gf->edges(); + //Replace edges by their compounds + std::set<GEdge*> mySet; + std::list<GEdge*>::iterator it = e.begin(); + while(it != e.end()){ + if((*it)->getCompound()){ + mySet.insert((*it)->getCompound()); + } + else{ + mySet.insert(*it); + } + ++it; + } + edges.clear(); + edges.insert(edges.begin(), mySet.begin(), mySet.end()); +} diff --git a/Geo/GFaceCompound.h b/Geo/GFaceCompound.h index 74aef07aad073da7433d332211c2d9df4c72af7a..bd316637053f94a814f690fe1490d98308a47caa 100644 --- a/Geo/GFaceCompound.h +++ b/Geo/GFaceCompound.h @@ -169,4 +169,6 @@ class GFaceCompound : public GFace { #endif +void replaceMeshCompound(GFace*,std::list<GEdge*>&); + #endif diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index 8053e7da9a3b7058207425a2c50ee5b280735ff4..e8e81abfafb722aeaf3a96140b9ca1956fb36ad2 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -9,6 +9,7 @@ #include "GmshMessage.h" #include "GModel.h" #include "GModelFactory.h" +#include "GFaceCompound.h" #include "MPoint.h" #include "MLine.h" #include "MTriangle.h" diff --git a/Geo/GModelVertexArrays.cpp b/Geo/GModelVertexArrays.cpp index b0c7fb5d40a59a5062913cbfd06ab4fdd61d233a..5b38ae903cfef69221a44e7b04e3c9177d1df3d9 100644 --- a/Geo/GModelVertexArrays.cpp +++ b/Geo/GModelVertexArrays.cpp @@ -7,6 +7,7 @@ #include "GmshMessage.h" #include "GmshDefines.h" #include "GModel.h" +#include "GFaceCompound.h" #include "GEdgeCompound.h" #include "MLine.h" #include "MTriangle.h" diff --git a/Graphics/drawGeom.cpp b/Graphics/drawGeom.cpp index c6e449d65f2ac3a3031be1105eb31f6a29079243..c2dcdd138fa738b709025150739f007e9d5d8b0c 100644 --- a/Graphics/drawGeom.cpp +++ b/Graphics/drawGeom.cpp @@ -10,6 +10,8 @@ #include "GModel.h" #include "SBoundingBox3d.h" #include "GmshMessage.h" +#include "GEdgeCompound.h" +#include "GFaceCompound.h" class drawGVertex { private : diff --git a/Graphics/drawMesh.cpp b/Graphics/drawMesh.cpp index f0983d2dcf2b9ef9cee2f9d7c40cc7961280b5b7..20b696303789397c62e9417a84b4dc7464a87b53 100644 --- a/Graphics/drawMesh.cpp +++ b/Graphics/drawMesh.cpp @@ -8,6 +8,8 @@ #include "GmshMessage.h" #include "GmshDefines.h" #include "GModel.h" +#include "GFaceCompound.h" +#include "GEdgeCompound.h" #include "MLine.h" #include "MTriangle.h" #include "MQuadrangle.h" diff --git a/Graphics/drawPost.cpp b/Graphics/drawPost.cpp index 7a5ebafa977659d2f49b20e75bb5c2803dd8ee28..f5349b02c4aa615612989374204af01dd22a7e20 100644 --- a/Graphics/drawPost.cpp +++ b/Graphics/drawPost.cpp @@ -6,6 +6,7 @@ #include <math.h> #include <algorithm> #include "GmshConfig.h" +#include "GmshDefines.h" #include "GmshMessage.h" #include "drawContext.h" #include "PView.h" diff --git a/Mesh/BackgroundMesh.cpp b/Mesh/BackgroundMesh.cpp index 4c3ceb2e0a5948503c0c8831f1d17fb6f322c0c5..960c410d097aa3cd04c42990ecaef6ca5330e294 100644 --- a/Mesh/BackgroundMesh.cpp +++ b/Mesh/BackgroundMesh.cpp @@ -10,6 +10,7 @@ #include "GVertex.h" #include "GEdge.h" #include "GFace.h" +#include "GFaceCompound.h" #include "GModel.h" #include "Field.h" #include "MElement.h" @@ -530,27 +531,6 @@ static void propagateValuesOnFace (GFace *_gf, #endif } -void replaceMeshCompound(GFace *gf, std::list<GEdge*> &edges) -{ -#if defined(HAVE_SOLVER) - std::list<GEdge*> e = gf->edges(); - //Replace edges by their compounds - std::set<GEdge*> mySet; - std::list<GEdge*>::iterator it = e.begin(); - while(it != e.end()){ - if((*it)->getCompound()){ - mySet.insert((*it)->getCompound()); - } - else{ - mySet.insert(*it); - } - ++it; - } - edges.clear(); - edges.insert(edges.begin(), mySet.begin(), mySet.end()); -#endif -} - void backgroundMesh::propagate1dMesh(GFace *_gf) { std::list<GEdge*> e;// = _gf->edges(); diff --git a/Mesh/BackgroundMesh.h b/Mesh/BackgroundMesh.h index 103bb924b8d6efdfd2ad2fa8317ec2f45b540a44..39c4883da43fca079c3a15ed9ba2269c3ac191f9 100644 --- a/Mesh/BackgroundMesh.h +++ b/Mesh/BackgroundMesh.h @@ -72,6 +72,5 @@ bool Extend1dMeshIn2dSurfaces(); bool Extend2dMeshIn3dVolumes(); SMetric3 max_edge_curvature_metric(const GVertex *gv, double &l); SMetric3 max_edge_curvature_metric(const GEdge *ge, double u, double &l); -void replaceMeshCompound(GFace*,std::list<GEdge*>&); #endif diff --git a/Mesh/CMakeLists.txt b/Mesh/CMakeLists.txt index 1e6e62b777fe5bf6947b018b0189abbc02a1f037..3a36bc4bfc2b8e05e1901fd86819c0cd259d2129 100644 --- a/Mesh/CMakeLists.txt +++ b/Mesh/CMakeLists.txt @@ -25,7 +25,6 @@ set(SRC highOrderSmoother.cpp highOrderTools.cpp meshPartition.cpp - meshPartitionOptions.cpp meshRefine.cpp multiscalePartition.cpp QuadTriUtils.cpp diff --git a/Mesh/meshGFaceLloyd.cpp b/Mesh/meshGFaceLloyd.cpp index 2f81ae95ecc4b570c70eb47e6cb40c980c9411a4..896edf9c0b87d83c67d202f3c718609f0f4d914b 100644 --- a/Mesh/meshGFaceLloyd.cpp +++ b/Mesh/meshGFaceLloyd.cpp @@ -7,26 +7,28 @@ // Tristan Carrier #include <set> +#include <fstream> #include "meshGFaceLloyd.h" - -#if defined(HAVE_BFGS) - #include "DivideAndConquer.h" +#include "GModel.h" #include "GFace.h" #include "MElement.h" #include "MVertex.h" #include "MTriangle.h" #include "Context.h" #include "meshGFace.h" +#include "meshGFaceOptimize.h" #include "BackgroundMesh.h" -#include <fstream> +#include "polynomialBasis.h" +#include "MElementOctree.h" + +#if defined(HAVE_BFGS) + #include "ap.h" #include "alglibinternal.h" #include "alglibmisc.h" #include "linalg.h" #include "optimization.h" -#include "polynomialBasis.h" -#include "MElementOctree.h" bool domain_search(MElementOctree* octree,double x,double y){ MElement* element; diff --git a/Mesh/meshPartitionOptions.cpp b/Mesh/meshPartitionOptions.cpp deleted file mode 100644 index 326a6d966ff74d63288a1b33bddbe0f08465cc82..0000000000000000000000000000000000000000 --- a/Mesh/meshPartitionOptions.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "meshPartitionOptions.h" -#include "meshPartition.h" -#include "GModel.h" -#include <map> - - -meshPartitionOptions::meshPartitionOptions() -{ - setDefaults(); -} - - //--Default values - -void meshPartitionOptions::setDefaults() -{ - partitioner = 2; - num_partitions=1; - ncon = 0; - renumber = 0; - global_method = 1; - architecture = 1; - ndims_tot = 2; - mesh_dims[0] = 4; - mesh_dims[1] = 1; - mesh_dims[2] = 1; - goal = 0; - local_method = 1; - rqi_flag = 1; - vmax = 250; - ndims = 1; - eigtol = 1.E-3; - seed = 7654321L; - refine_partition = false; - internal_vertices = false; - refine_map = true; - terminal_propogation = false; - algorithm = 1; - edge_matching = 3; - refine_algorithm = 3; - createPartitionBoundaries = true; - createGhostCells = true; - triWeight = 1; - quaWeight = 1; - tetWeight = 1; - priWeight = 1; - pyrWeight = 1; - hexWeight = 1; -} - -void meshPartitionOptions::partition(GModel *model) -{ - PartitionMesh(model, *this); -} - -void meshPartitionOptions::setAlgorithm(int algo) -{ - algorithm=algo; -} diff --git a/Mesh/meshPartitionOptions.h b/Mesh/meshPartitionOptions.h index 46e80def724cfb97969f8e62eebee234f179b710..4aa66e9bbf8323aedb93e75eb14cfa2e24fd772b 100644 --- a/Mesh/meshPartitionOptions.h +++ b/Mesh/meshPartitionOptions.h @@ -2,118 +2,131 @@ // // See the LICENSE.txt file for license information. Please report all // bugs and problems to <gmsh@geuz.org>. -#include <map> -#include "GModel.h" -#include "meshPartition.h" -#include "fullMatrix.h" + #ifndef _MESH_PARTITION_OPTIONS_H_ #define _MESH_PARTITION_OPTIONS_H_ +#include <map> + class meshPartitionOptions { - private: - public: + // General + int partitioner; // 1 - Chaco + // 2 - METIS + int num_partitions; + int ncon; // Number of constraints/different weights + int renumber; + bool createPartitionBoundaries; + bool createGhostCells; -//--General - - int partitioner; // 1 - Chaco - // 2 - METIS - int num_partitions; - - int ncon; // Number of constraints/different weights - - int renumber; - - bool createPartitionBoundaries; - bool createGhostCells; - -//--Chaco - - int global_method; // 1 - Multilevel-KL - // 2 - Spectral - // 3 - Inertial (Disabled) - // 4 - Linear - // 5 - Random - // 6 - Scattered - int architecture; // 0 - hypercube - // 1-3 - dimensional mesh parallel - int ndims_tot; // Number of hypercube dimensions */ - int mesh_dims[3]; // Number of partitions in each - // dimension for a dimensional - // architecture - double *goal; // Not-implemented (Weights vertices in - // a set) - int local_method; // 1 - Kernighan-Lin - // 2 - None - int rqi_flag; // Eigensolver for spectral partitioner - // 0 - Lanczos - // 1 - Multilevel RQI/Symmlq - int vmax; // Number of vertices in the coarsest - // graph. - int ndims; // Number of divisions at each stage - // 1 - Bisection - // 2 - Quadrisection - // 3 - Octasection - double eigtol; // Tolerance to the eigensolver - long seed; // RNG seed + // Chaco + int global_method; // 1 - Multilevel-KL + // 2 - Spectral + // 3 - Inertial (Disabled) + // 4 - Linear + // 5 - Random + // 6 - Scattered + int architecture; // 0 - hypercube + // 1-3 - dimensional mesh parallel + int ndims_tot; // Number of hypercube dimensions */ + int mesh_dims[3]; // Number of partitions in each + // dimension for a dimensional + // architecture + double *goal; // Not-implemented (Weights vertices in + // a set) + int local_method; // 1 - Kernighan-Lin + // 2 - None + int rqi_flag; // Eigensolver for spectral partitioner + // 0 - Lanczos + // 1 - Multilevel RQI/Symmlq + int vmax; // Number of vertices in the coarsest + // graph. + int ndims; // Number of divisions at each stage + // 1 - Bisection + // 2 - Quadrisection + // 3 - Octasection + double eigtol; // Tolerance to the eigensolver + long seed; // RNG seed - // parameters - int refine_partition; // Refine partitions at each level - int internal_vertices; // Increase internal vertices - int refine_map; // Refine processor mapping - int terminal_propogation; // Run with terminal propogation + // parameters + int refine_partition; // Refine partitions at each level + int internal_vertices; // Increase internal vertices + int refine_map; // Refine processor mapping + int terminal_propogation; // Run with terminal propogation - //--METIS + // METIS + int algorithm; + // 1 - Recursive + // 2 - K-way + // 3 - Nodal weight + // 4 - Multi-Constrained Recursive + // 5 - Multi-Constrained K-way + int edge_matching; // 1 - Random matching + // 2 - Heavy-edge matching + // 3 - Sorted heavy-edge matching + int refine_algorithm; // 1 - Random boundary refinement + // 2 - Greedy boundary refinement + // 3 - Random boundary refinement (with + // minimization of connectivity + // along sub-domains) - int algorithm; - // 1 - Recursive - // 2 - K-way - // 3 - Nodal weight - // 4 - Multi-Constrained Recursive - // 5 - Multi-Constrained K-way - int edge_matching; // 1 - Random matching - // 2 - Heavy-edge matching - // 3 - Sorted heavy-edge matching - int refine_algorithm; // 1 - Random boundary refinement - // 2 - Greedy boundary refinement - // 3 - Random boundary refinement (with - // minimization of connectivity - // along sub-domains) + // element weights for load-balancing (currently used in METIS algorithm 3) + int triWeight; + int quaWeight; + int tetWeight; + int priWeight; + int pyrWeight; + int hexWeight; - // element weights for load-balancing (currently used in METIS algorithm 3) + // NODAL WEIGHT + std::vector<int> nodalWeights; + std::map<int, std::vector<int> > weightMap; + std::vector<int> tolerance; - int triWeight; - int quaWeight; - int tetWeight; - int priWeight; - int pyrWeight; - int hexWeight; - - //--NODAL WEIGHT - std::vector<int> nodalWeights; - - std::map<int, std::vector<int> > weightMap; - - std::vector<int> tolerance; - - - public: - - //--Constructor - - meshPartitionOptions(); - - //--Default values - - void setDefaults(); - void setAlgorithm(int algo); - void setNumOfPartitions(int numPart){num_partitions=numPart;}; - int getNumOfPartitions(){return num_partitions;}; - void setNumConstraints(int numConst){ncon=numConst;}; - int getNumConstraints(){return ncon;}; - void partition(GModel *model); - std::map<int, std::vector<int> >& getWeightMap(){return weightMap;}; + public: + meshPartitionOptions(){ setDefaults(); } + void setAlgorithm(int algo){ algorithm = algo; } + void setNumOfPartitions(int numPart){ num_partitions = numPart; } + int getNumOfPartitions(){ return num_partitions; } + void setNumConstraints(int numConst){ ncon = numConst; } + int getNumConstraints(){ return ncon; } + std::map<int, std::vector<int> > &getWeightMap(){ return weightMap; } + void setDefaults() + { + partitioner = 2; + num_partitions=1; + ncon = 0; + renumber = 0; + global_method = 1; + architecture = 1; + ndims_tot = 2; + mesh_dims[0] = 4; + mesh_dims[1] = 1; + mesh_dims[2] = 1; + goal = 0; + local_method = 1; + rqi_flag = 1; + vmax = 250; + ndims = 1; + eigtol = 1.E-3; + seed = 7654321L; + refine_partition = false; + internal_vertices = false; + refine_map = true; + terminal_propogation = false; + algorithm = 1; + edge_matching = 3; + refine_algorithm = 3; + createPartitionBoundaries = true; + createGhostCells = true; + triWeight = 1; + quaWeight = 1; + tetWeight = 1; + priWeight = 1; + pyrWeight = 1; + hexWeight = 1; + } }; #endif diff --git a/Numeric/DivideAndConquer.cpp b/Numeric/DivideAndConquer.cpp index 55ce4be000c6848e67723720d45ba6f1a70955db..4204803abf262912820aef56260c58956bf7daa7 100644 --- a/Numeric/DivideAndConquer.cpp +++ b/Numeric/DivideAndConquer.cpp @@ -24,6 +24,7 @@ // FIXME: should not introduce dependencies to Geo/ code in Numeric #include "GPoint.h" #include "GFace.h" +#include "GFaceCompound.h" #include "MLine.h" #define Pred(x) ((x)->prev) diff --git a/Plugin/Distance.cpp b/Plugin/Distance.cpp index 7f69090934bdefec0f8a152adfd95179c1d849b2..bbac922dc33b638cd3883a175cb3c5f3f93d5d51 100644 --- a/Plugin/Distance.cpp +++ b/Plugin/Distance.cpp @@ -150,7 +150,6 @@ void GMSH_DistancePlugin::printView(std::vector<GEntity*> _entities, PView *GMSH_DistancePlugin::execute(PView *v) { - int id_pt = (int) DistanceOptions_Number[0].def; int id_line = (int) DistanceOptions_Number[1].def; int id_face = (int) DistanceOptions_Number[2].def; @@ -159,7 +158,8 @@ PView *GMSH_DistancePlugin::execute(PView *v) PView *view = new PView(); _data = getDataList(view); -#ifdef HAVE_TAUCS +#if defined(HAVE_SOLVER) +#if defined(HAVE_TAUCS) linearSystemCSRTaucs<double> *lsys = new linearSystemCSRTaucs<double>; #else linearSystemCSRGmm<double> *lsys = new linearSystemCSRGmm<double>; @@ -168,7 +168,8 @@ PView *GMSH_DistancePlugin::execute(PView *v) lsys->setPrec(5.e-8); #endif dofManager<double> * dofView = new dofManager<double>(lsys); - +#endif + std::vector<GEntity*> _entities; GModel::current()->getEntities(_entities); GEntity* ge = _entities[_entities.size()-1]; diff --git a/Plugin/ExtractEdges.cpp b/Plugin/ExtractEdges.cpp index d7591e9578936bb5a6fc1ac6242362c02f1b52d5..826894a91cc41d97ab5237eef803dd0bd70106eb 100644 --- a/Plugin/ExtractEdges.cpp +++ b/Plugin/ExtractEdges.cpp @@ -3,6 +3,7 @@ // See the LICENSE.txt file for license information. Please report all // bugs and problems to <gmsh@geuz.org>. +#include "GmshConfig.h" #include "GModel.h" #include "meshGFaceOptimize.h" #include "ExtractEdges.h" @@ -52,6 +53,7 @@ static void add_edge(edge_angle &ea, PViewDataList *data) PView *GMSH_ExtractEdgesPlugin::execute(PView *v) { +#if defined(HAVE_MESH) std::vector<MTriangle*> elements; for(GModel::fiter it = GModel::current()->firstFace(); it != GModel::current()->lastFace(); ++it) @@ -88,4 +90,8 @@ PView *GMSH_ExtractEdgesPlugin::execute(PView *v) data2->finalize(); return v2; +#else + Msg::Error("Plugin(ExtractEdges) requires the mesh module"); + return v; +#endif } diff --git a/Post/PViewDataListIO.cpp b/Post/PViewDataListIO.cpp index acf26593e51c8c1c912ae2cf696f69558af8dd0c..e1ad3f51dfdb65546eef470d6445583ea62c623a 100644 --- a/Post/PViewDataListIO.cpp +++ b/Post/PViewDataListIO.cpp @@ -6,6 +6,7 @@ #include <string.h> #include <set> #include "PViewDataList.h" +#include "MElement.h" #include "Numeric.h" #include "StringUtils.h" #include "GmshMessage.h" diff --git a/Post/PViewVertexArrays.cpp b/Post/PViewVertexArrays.cpp index 0c0160cc2d9be6c272f9298ebae0ef2b043b3079..97990fdc2e23ead89a58a6685ce6a4a8e47881f3 100644 --- a/Post/PViewVertexArrays.cpp +++ b/Post/PViewVertexArrays.cpp @@ -8,6 +8,8 @@ #include "GmshDefines.h" #include "onelab.h" #include "Iso.h" +#include "MEdge.h" +#include "MFace.h" #include "PView.h" #include "PViewOptions.h" #include "PViewData.h"