Select Git revision
linearSystemPETSc.h
Forked from
gmsh / gmsh
Source project has a limited visibility.
-
Emilie Marchandise authoredEmilie Marchandise authored
GRbf.cpp 40.84 KiB
// Gmsh - Copyright (C) 1997-2016 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>.
//
// Contributed by Cecile Piret
#include <math.h>
#include <vector>
#include "GmshConfig.h"
#include "GRbf.h"
#include "OS.h"
#include "fullMatrix.h"
#include "Octree.h"
#include "SPoint3.h"
#include "SVector3.h"
#include "SBoundingBox3d.h"
#include "OS.h"
#include "MVertex.h"
#include "MVertexRTree.h"
#if defined(HAVE_SOLVER)
#include "linearSystem.h"
#endif
#if defined(HAVE_ANN)
#include "ANN/ANN.h"
#endif
static void SphereBB(void *a, double*mmin, double*mmax)
{
Sphere *t = (Sphere *)a;
mmin[0] = t->center.x()-t->radius;
mmin[1] = t->center.y()-t->radius;
mmin[2] = t->center.z()-t->radius;
mmax[0] = t->center.x()+t->radius;
mmax[1] = t->center.y()+t->radius;
mmax[2] = t->center.z()+t->radius;
}
static void SphereCentroid(void *a, double*c)
{
Sphere *t = (Sphere *)a;
c[0] = t->center.x();
c[1] = t->center.y();
c[2] = t->center.z();
}
static int SphereInEle(void *a, double*c)
{
Sphere *t = (Sphere *)a;
double dist = sqrt((c[0]-t->center.x())*(c[0]-t->center.x())+
(c[1]-t->center.y())*(c[1]-t->center.y())+
(c[2]-t->center.z())*(c[2]-t->center.z()) );
if(dist < t->radius){
return 1;
}
return 0;
}
static void printNodes(std::set<MVertex *> myNodes)
{
FILE * xyz = Fopen("myNodes.pos","w");
if(xyz){
fprintf(xyz,"View \"\"{\n");
for(std::set<MVertex *>::iterator itv = myNodes.begin(); itv !=myNodes.end(); ++itv){
MVertex *v = *itv;
fprintf(xyz,"SP(%g,%g,%g){%d};\n", v->x(), v->y(), v->z(), v->getNum());
}
fprintf(xyz,"};\n");