11 #define ANSI_DECLARATORS 12 #include "../triangle/triangle.h" 15 #undef ANSI_DECLARATORS 23 std::printf(
"pointlist=%p\n",in->
pointlist);
38 std::printf(
"holelist=%p\n",in->
holelist);
42 std::printf(
"edgelist=%p\n",in->
edgelist);
44 std::printf(
"normlist=%p\n",in->
normlist);
50 double dx=points(p2,0)-points(p1,0);
51 double dy=points(p2,1)-points(p1,1);
52 return sqrt(dx*dx+dy*dy);
55 void SimpleGrid::calc_hminmax(
double& hmin,
double& hmax)
const 59 auto cells=*SimpleGrid::cells;
60 auto points=*SimpleGrid::points;
62 for (
int icell=0; icell<ncells();icell++)
64 double h=
dist(points, cells(icell,0), cells(icell,1));
68 h=
dist(points, cells(icell,1), cells(icell,2));
72 h=
dist(points, cells(icell,0), cells(icell,2));
79 SimpleGrid::SimpleGrid(
const Geometry & geometry,
const char * flags)
81 if (strchr(flags,
'z')==
nullptr)
83 throw std::runtime_error(
"numcxx: triangulate: Missing 'z' flag");
147 throw std::runtime_error(
"numcxx: triangulate: Missing point list");
153 throw std::runtime_error(
"numcxx: triangulate: Missing bfaceregions");
161 throw std::runtime_error(
"numcxx: triangulate: Missing bface list");
168 int nregs,nholes,ireg,ihole;
173 throw std::runtime_error(
"numcxx: triangulate: Missing region numbers");
177 throw std::runtime_error(
"numcxx: triangulate: Missing region volumes");
189 in.
holelist=(
double*)malloc(2*nholes*
sizeof(
double));
190 in.
regionlist=(
double*)malloc(4*nregs*
sizeof(
double));
224 printf(
"out (flags=%s):\n",flags);
263 throw std::runtime_error(
"numcxx: triangulate: Missing segment list");
Class collecting data for the description of piecewise linear geometries.
REAL * pointattributelist
int numberofpointattributes
std::shared_ptr< TArray1< int > > regionnumbers
nreg array of integers containing region markers
A::value_type max(const A &a)
Maximum of array or expression.
std::shared_ptr< TArray2< int > > bfaces
nbfaces x dim array of of integers describing boundary segments
Header for simple grid data class.
REAL * triangleattributelist
Main header of the library.
A::value_type min(const A &a)
Minimum of of array or expression.
std::shared_ptr< TArray1< int > > bfaceregions
nbfaces array of integers describing boundary segment markers
std::shared_ptr< TArray2< double > > regionpoints
nreg x dim array of doubles containing point coordinates of region points
std::shared_ptr< TArray2< double > > points
Points: npt x dim array of double containing point coordinates.
std::shared_ptr< TArray1< double > > regionvolumes
nreg array of integers containing the maximum volumes/areas of triangles in a region ...
double dist(const numcxx::DArray2 &points, int p1, int p2)
void print_triangulateio(triangle::triangulateio *in)
void trifree(VOID *memptr)
Two-dimensional array class.
void triangulate(char *, struct triangulateio *, struct triangulateio *, struct triangulateio *)
int numberoftriangleattributes