/usr/include/MAdLib/AdaptInterface.h is in libmadlib-dev 1.3.0-2.1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | // -*- C++ -*-
// -------------------------------------------------------------------
// MAdLib - Copyright (C) 2008-2009 Universite catholique de Louvain
//
// See the Copyright.txt and License.txt files for license information.
// You should have received a copy of these files along with MAdLib.
// If not, see <http://www.madlib.be/license/>
//
// Please report all bugs and problems to <contrib@madlib.be>
//
// Authors: Gaetan Compere, Jean-Francois Remacle
// -------------------------------------------------------------------
#ifndef _H_ADAPTINTERFACE
#define _H_ADAPTINTERFACE
// from Geo
#include "ModelInterface.h"
// from Mesh
#include "MeshDataBaseInterface.h"
#include "CheckMesh.h"
#ifdef PARALLEL
#include "MeshDataBaseComm.h"
#endif
// from Adapt
#include "MAdOutput.h"
#include "CallbackDefinition.h"
#include <set>
#include <string>
#include <vector>
namespace MAd {
class SizeFieldManager;
class geoMatcher;
class mobileObjectSet;
class MeshParametersManager;
// Local mesh modification operators
class edgeSplitOp;
class edgeCollapseOp;
class faceCollapseOp;
class DESCOp;
class edgeSwapOp;
class faceSwapOp;
class vertexMoveOp;
class regionRemoveOp;
class sliverFaceHandler;
class sliverRegionHandler;
// -------------------------------------------------------------------
enum algorithmDefinition {
SPT_SWP_SLV_CPS,
CPS_SWP_SLV_SPT,
SLV_CPS_SWP_SPT
};
#ifdef PARALLEL
enum loadBalanceAlgorithm {
DEFAULT_ALGORITHM,
METIS_ALGORITHM
};
#endif
// -------------------------------------------------------------------
// -------------------------------------------------------------------
class MeshAdapter {
public:
MeshAdapter(pMesh m, pSField sf=NULL);
~MeshAdapter();
// --------------------------------------------
// gives an overview of the current parameters
void printParameters() const;
void addCallback(CBFunction CB, void* userData,
CBFunc_move CB_move=0, void* userData_move=0);
void addSizeField(pSField sf);
// whether or not the global size field is smoothed and maximum gradient
void setSizeFieldSmoothing(bool, double maxGrad=1.);
// set the maximum number of iterations available to reach the 'convergence'
// of the global mesh adaptation procedure
void setMaxIterationsNumber(int max);
#ifdef PARALLEL
// set load balancing algorithm
void setLoadBalancingAlgorithm( loadBalanceAlgorithm lbAlgo );
// set the data Exchanger
// void setDataExchanger( MDB_DataExchanger* dataExch);
#endif
// impose the interval governing edges length in the transformed space
void setEdgeLenSqBounds(double lower, double upper);
// set permission for operators to modify slightly boundaries
// (default: false) and tolerance for the relative volume/area
// modifications.
// Edge collapse and face collapse:
void setCollapseOnBoundary(bool accept=true, double tolerance=1.e-6);
// Edge swap:
void setSwapOnBoundary(bool accept=true, double tolerance=1.e-6);
// impose the element quality from which a swap is not required
void setNoSwapQuality(double noSwapQuality);
// impose a threshold rate of improvement for edge and face swaps
void setSwapMinImproveRatio(double ratio);
// impose the maximum quality of a sliver
void setSliverQuality(double sliverQuality);
// Allow or forbid operations creating a sliver.
// If allowed and a bound is prescribed, it is allowed only if the edge is
// longer/shorter than the bound (bound is expressed as the square of
// adimensional edge length)
void setSliverPermissionInESplit (bool perm, double lenSqBound=-1.);
void setSliverPermissionInECollapse(bool perm, double lenSqBound=-1.);
// tell if you want to project new vertices on geometric entities
void setGeoTracking(bool enable, bool cavityEqualMesh=false,
int cavityThickness=2, double chi=1.0,
bool strictChecking=false, bool forceRelocation=false);
// set a value for a very huge edge length (default=1.e14)
void setInfiniteLength(double length);
// frequency at which the size fields are updated inside the global loop
// (useful for local and analytical SF)
void setSFUpdateFrequency(int freq);
// Set verbosity:
// < 0 : no detail
// 1 : global procedure details
// > 2 : iterations details
void setVerbosity(int _verbosity);
// constraint a mesh/geometric entity and all its downward entities
void clearConstraints() const;
void setConstraint(pEntity e) const;
void setConstraint(pGEntity ge) const;
void setConstraint(int type, int id) const;
// unconstrain a geometric entity
void removeConstraint(int type, int id) const;
void removeConstraint(pGEntity ge) const;
// manage the physical time
void incrementTime(double dt);
void setTime(double t);
double getTime() const;
void updateSizeField();
// functions to keep track of the initial coordinates
void storeInitialCoordinates();
void removeStoredCoordinates();
// add predefined mobile objects
void registerObjects(mobileObjectSet* objs);
// will attach/get the datas to the nodes of the mesh
// order in vector is the node iterator order
void registerData (std::string name, const std::vector<double>) const;
void registerVData (std::string name, const std::vector<std::vector<double> >) const;
void getMeshData (std::string name, std::vector<double> *) const;
void getMeshVData (std::string name, std::vector<std::vector<double> > *) const;
void removeData (std::string name) const;
void removeVData (std::string name) const;
public:
// ---------------- OPERATIONS ----------------
// ----- Level 1 -----
// ---> Elementary operations
// Split the edge and if 'checkSize' is true, check that the two resulting
// edges are not short edges.
bool splitEdge (pEdge e, bool checkSize=false);
bool collapseEdge (pEdge e);
void collapseEdgeBrute (pEdge e); // use it only if you know what your are doing
bool collapseFace(pFace f, pEdge e);
bool DSplitCollapseEdge(pRegion pr, pEdge edge1, pEdge edge2);
bool swapEdge (pEdge e);
bool swapFace (pFace f);
bool removeRegion(pRegion region);
bool moveVertex (pVertex v, double dxyz[3]);
bool putVertex (pVertex v, double xyz[3]);
// bool moveVertices (std::multiset<vDisplacement,vDisplacementLess>& vDisps);
// ----- Level 2 -----
// ---> Loops on one elementary operation
// node repositioning
double LaplaceSmoothing();
// topology operations
int eSplitLoop();
int eCollapseLoop();
int eSplitCollapseLoop();
int edgeSwapLoop();
int faceSwapLoop();
int splitEveryEdgeOnce();
// slivers handling
int removeSlivers();
// geometry matching
void snapVertices();
// ----- Level 3 -----
// ---> Procedures with a global objective
int optimiseEdgeLength();
int optimiseElementShape();
int splitLongestEdges();
int runOneIter();
void uglyTheMesh(double avgQualThresh, int maxIt);
int removeNegativeElements();
// ----- Level 4 -----
// ---> Global procedure
void run();
// ----- objects motion -----
// move boundaries without repositioning nodes in the volume
int partlyMoveObjects (double t, double dt, double* part);
// move boundaries and reposition all nodes with an elasticity analogy
// subAdaptation: allow sliver elimination and mesh optimization if necessary
// qualityThreshold: at which quality do we optimize the mesh (if allowed)
// chi: stiffness alteration coefficient (-1 = none)
// meshIsCavity: true = elastic computation on whole mesh
// cavityThickness: nb layers of elements if mesh is not the cavity
void moveObjectsAndReposition (double t, double dt,
bool subAdaptation=true,
double qualityThreshold=0.,
double chi=-1.,
bool meshIsCavity=true,
int cavityThickness=3);
// --------------------------------------------
public:
// ------ Diagnostics ------
// get informations on mesh quality
void getStatistics(double * meanQuality, double * worstQuality) const;
// get information on applied mesh modifications
void getModificationsInfo(int * nSplit, int * nColl,
int * nSwap, double * cpuSplit,
double * cpuColl, double * cpuSwap,
double * cpuSliv) const;
// about all datas attached to the nodes
void nodalDataDiagnostics(std::ostream& out) const;
// journals listing all operations tested or applied
void setDebugLevel(int debug) { debugLevel = debug; }
void openJournal() const;
void setReferenceJournal(std::string& name) const;
void flushJournal(std::ostream& out) const;
// sliver outputs
void enableSliverReports();
void testSliverOperators(bool test);
// performs several checks to check the validity of the mesh
bool checkTheMesh(int verbose=1,
std::ostream& out=std::cout,
MeshStatus * status=NULL) const;
// get infos about mobile objects
void infoMobileObjects(std::ostream& out=std::cout) const;
public:
// ------ Outputs ------
// set the path to output directory
void setOutputPrefix(std::string prefix);
// write mesh with required postpro data in 'pos' format (Gmsh)
void writePos(std::string fn, MAdOutputData type=OD_CONSTANT) const;
// write mesh in 'msh' format (Gmsh)
void writeMsh(std::string fn) const;
// write a .pos file with the distance to walls for every local size field
void writeDistanceToWalls(std::string fnBase) const;
// write a .pos file with the 'volumic' curvature for every local size field
void writeVolumicCurvature(std::string fnBase) const;
// get global data over the mesh
void printStatistics(std::ostream& out) const;
void printSliverRegionStatistics(std::ostream& out) const;
public:
// save all available informations to output directory and abort
void abort(int line=-1, const char* file=NULL) const;
// --------------------------------------------
private:
void setDefaultValues();
void buildOperators();
void removeOperators();
private:
pMesh mesh;
SizeFieldManager * SFManager;
mobileObjectSet * objects;
// ----- Local mesh modification operators -----
edgeSplitOp * eSplitOp;
edgeCollapseOp * eCollapseOp;
faceCollapseOp * fCollapseOp;
DESCOp * descOp;
edgeSwapOp * eSwapOp;
faceSwapOp * fSwapOp;
vertexMoveOp * vMoveOp;
regionRemoveOp * rRegionOp;
sliverFaceHandler * sliverFOp;
sliverRegionHandler * sliverROp;
// ----- Geometry related -----
geoMatcher * geoTracker;
// ----- Adaptation parameters -----
algorithmDefinition algorithm;
int maxIterationsNumber;
MeshParametersManager& mpm;
#ifdef PARALLEL
loadBalanceAlgorithm load_balance_algorithm;
MDB_DataExchanger* dataExchanger;
#endif
int updateSFFrequency;
// ----- Output parameters -----
int verbosity;
std::string outPrefix;
int debugLevel;
};
// -------------------------------------------------------------------
} // End of namespace MAd
#endif
|