Select Git revision
BackgroundMesh.cpp 22.33 KiB
// Gmsh - Copyright (C) 1997-2017 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@onelab.info>.
#include "GmshMessage.h"
#include "BackgroundMesh.h"
#include "Numeric.h"
#include "Context.h"
#include "GVertex.h"
#include "GEdge.h"
#include "GEdgeCompound.h"
#include "GFace.h"
#include "GFaceCompound.h"
#include "GModel.h"
#include "OS.h"
#include "Field.h"
#include "MElement.h"
#include "MElementOctree.h"
#include "MLine.h"
#include "MTriangle.h"
#include "MQuadrangle.h"
#include "MVertex.h"
#if defined(HAVE_SOLVER)
#include "dofManager.h"
#include "laplaceTerm.h"
#include "linearSystemGMM.h"
#include "linearSystemCSR.h"
#include "linearSystemFull.h"
#include "linearSystemPETSc.h"
#endif
#if defined(HAVE_ANN)
static int _NBANN = 2;
#endif
void backgroundMesh::set(GFace *gf)
{
if (_current) delete _current;
_current = new backgroundMesh(gf);
}
void backgroundMesh::setCrossFieldsByDistance(GFace *gf)
{
if (_current) delete _current;
_current = new backgroundMesh(gf, true);
}
void backgroundMesh::unset()
{
if (_current) delete _current;
_current = 0;
}
backgroundMesh::backgroundMesh(GFace *_gf, bool cfd)
#if defined(HAVE_ANN)
: _octree(0), uv_kdtree(0), nodes(0), angle_nodes(0), angle_kdtree(0)
#endif
{
if (cfd){
Msg::Info("Building A Cross Field Using Closest Distance");
propagateCrossFieldByDistance(_gf);
return;
}
// create a bunch of triangles on the parametric space
// those triangles are local to the backgroundMesh so that
// they do not depend on the actual mesh that can be deleted