#include #include #include "common/pmmc.h" #include "common/Domain.h" using namespace std; /* * Compare the measured and analytical curvature for a sphere * */ int main(int argc, char **argv) { int i,j,k; int Nx,Ny,Nz; double Lx,Ly,Lz; double fluid_isovalue=0.0; double solid_isovalue=0.0; Lx = Ly = Lz = 1.0; Nx = Ny = Nz = 102; //........................................................................... // Set up the cube list //........................................................................... int ncubes = (Nx-2)*(Ny-2)*(Nz-2); // Exclude the "upper" halo IntArray cubeList(3,ncubes); pmmc_CubeListFromMesh(cubeList, ncubes, Nx, Ny, Nz); //........................................................................... //**************************************************************************************** // Create the structures needed to carry out the PMMC algorithm //**************************************************************************************** DTMutableList nw_pts(20); DTMutableList ns_pts(20); DTMutableList ws_pts(20); DTMutableList nws_pts(20); // initialize triangle lists for surfaces IntArray nw_tris(3,20); IntArray ns_tris(3,20); IntArray ws_tris(3,20); // initialize list for line segments IntArray nws_seg(2,20); DTMutableList tmp(20); DoubleArray wn_curvature(20); int n_nw_pts=0,n_ns_pts=0,n_ws_pts=0,n_nws_pts=0; int n_nw_tris=0, n_ns_tris=0, n_ws_tris=0, n_nws_seg=0; // Initialize arrays for local solid surface DTMutableList local_sol_pts(20); int n_local_sol_pts = 0; IntArray local_sol_tris(3,18); int n_local_sol_tris; DoubleArray values(20); DTMutableList local_nws_pts(20); int n_local_nws_pts; //**************************************************************************************** int nspheres=1; // Set up the signed distance function for a sphere double *cx,*cy,*cz,*rad; cx = new double[nspheres]; cy = new double[nspheres]; cz = new double[nspheres]; rad = new double[nspheres]; // Sphere in the middle of the domain cx[0] = cy[0] = cz[0] = 0.5; rad[0] = 0.3; DoubleArray SignDist(Nx,Ny,Nz); DoubleArray Phase(Nx,Ny,Nz); DoubleArray GaussCurvature(Nx,Ny,Nz); DoubleArray MeanCurvature(Nx,Ny,Nz); DoubleArray CubeValues(2,2,2); // Compute the signed distance function SignedDistance(Phase.get(),nspheres,cx,cy,cz,rad,Lx,Ly,Lz,Nx,Ny,Nz,0,0,0,1,1,1); for (k=0; k 0.01 ){ toReturn = 1; printf("Mean curvature test error exceeds relative error tolerance \n "); } return toReturn; }