From b85570d1b5319f09bd0b6576dc40d7c69577ceaa Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Thu, 24 Nov 2011 18:59:25 +0000 Subject: [PATCH] fix compilation without mesh module --- Common/GmshMessage.cpp | 1 + Fltk/onelabWindow.cpp | 2 + Geo/GFace.cpp | 1 + Geo/GFaceCompound.cpp | 27 ++++- Geo/GFaceCompound.h | 2 + Geo/GModel.cpp | 1 + Geo/GModelVertexArrays.cpp | 1 + Graphics/drawGeom.cpp | 2 + Graphics/drawMesh.cpp | 2 + Graphics/drawPost.cpp | 1 + Mesh/BackgroundMesh.cpp | 22 +--- Mesh/BackgroundMesh.h | 1 - Mesh/CMakeLists.txt | 1 - Mesh/meshGFaceLloyd.cpp | 14 ++- Mesh/meshPartitionOptions.cpp | 58 --------- Mesh/meshPartitionOptions.h | 213 ++++++++++++++++++---------------- Numeric/DivideAndConquer.cpp | 1 + Plugin/Distance.cpp | 7 +- Plugin/ExtractEdges.cpp | 6 + Post/PViewDataListIO.cpp | 1 + Post/PViewVertexArrays.cpp | 2 + 21 files changed, 171 insertions(+), 195 deletions(-) delete mode 100644 Mesh/meshPartitionOptions.cpp diff --git a/Common/GmshMessage.cpp b/Common/GmshMessage.cpp index 532f894c99..a9301703df 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 181bf3cf15..25309b653e 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 c3592f297c..f877f61eb2 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 278273b0aa..1eb7f07e5f 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 74aef07aad..bd31663705 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 8053e7da9a..e8e81abfaf 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 b0c7fb5d40..5b38ae903c 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 c6e449d65f..c2dcdd138f 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 f0983d2dcf..20b6963037 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 7a5ebafa97..f5349b02c4 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 4c3ceb2e0a..960c410d09 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 103bb924b8..39c4883da4 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 1e6e62b777..3a36bc4bfc 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 2f81ae95ec..896edf9c0b 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 326a6d966f..0000000000 --- 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 46e80def72..4aa66e9bbf 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 55ce4be000..4204803abf 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 7f69090934..bbac922dc3 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 d7591e9578..826894a91c 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 acf26593e5..e1ad3f51df 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 0c0160cc2d..97990fdc2e 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" -- GitLab