9 #include "../MemOps/MemOps.h"
10 #include "../Exceptions/exceptions.h"
13 int ExpWrite(
int nprof,
int* profnvertices,
double** pprofx,
double** pprofy,
char* domainname){
19 if((fid=fopen(domainname,
"w"))==NULL)
_error_(
"could not open domain file " << domainname);
22 for(
int counter=0;counter<nprof;counter++){
25 fprintf(fid,
"## Name:%s\n",domainname);
26 fprintf(fid,
"## Icon:0\n");
27 fprintf(fid,
"# Points Count Value\n");
28 fprintf(fid,
"%u %s\n",profnvertices[counter] ,
"1.");
29 fprintf(fid,
"# X pos Y pos\n");
32 for(
int i=0;i<profnvertices[counter];i++){
33 fprintf(fid,
"%lf\t%lf\n",pprofx[counter][i],pprofy[counter][i]);
37 if(counter<nprof-1) fprintf(fid,
"\n");
45 int IsInPolySerial(
double* in,
double* xc,
double* yc,
int numvertices,
double* x,
double* y,
int nods,
int edgevalue){
50 for(
int i=0;i<nods;i++){
58 if (
pnpoly(numvertices,xc,yc,x0,y0,edgevalue)){
70 int pnpoly(
int npol,
double *xp,
double *yp,
double x,
double y,
int edgevalue) {
72 double n1, n2, normp, scalar;
76 for (i = 0, j = npol-1; i < npol; j = i++) {
77 n1=pow(yp[i]-yp[j],2.0)+pow(xp[i]-xp[j],2.0);
78 n2=pow(y-yp[j],2.0)+pow(x-xp[j],2.0);
80 scalar=(yp[i]-yp[j])*(y-yp[j])+(xp[i]-xp[j])*(x-xp[j]);
91 for (i = 0, j = npol-1; i < npol; j = i++) {
92 if ((((yp[i]<=y) && (y<yp[j])) ||
93 ((yp[j]<=y) && (y<yp[i]))) &&
94 (x < (xp[j] - xp[i]) * (y - yp[i]) / (yp[j] - yp[i]) + xp[i])){