/* * Adds points using the mod-2 rule of SFS. This is used to add the boundary * points of dim-1 geometries (Curves/MultiCurves). According to the SFS, * an endpoint of a Curve is on the boundary * iff if it is in the boundaries of an odd number of Geometries */ void GeometryGraph::insertBoundaryPoint(int argIndex,const Coordinate& coord) { Node *n=nodes->addNode(coord); Label *lbl=n->getLabel(); // the new point to insert is on a boundary int boundaryCount=1; // determine the current location for the point (if any) int loc=Location::UNDEF; if (lbl!=NULL) loc=lbl->getLocation(argIndex,Position::ON); if (loc==Location::BOUNDARY) boundaryCount++; // determine the boundary status of the point according to the // Boundary Determination Rule int newLoc = determineBoundary(boundaryNodeRule, boundaryCount); lbl->setLocation(argIndex,newLoc); }
void display(void) { if (boundary) { glClear(GL_COLOR_BUFFER_BIT); glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); determineBoundary(render, 250); } else { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); glDisable(GL_CULL_FACE); render(); } glutSwapBuffers(); }
Simulation3D::Simulation3D(double L_x, double L_y, double L_z, double T, unsigned int n_cells, unsigned int n_steps, unsigned int procs_x, unsigned int procs_y, unsigned int procs_z, unsigned int block_size, std::string& dump_dir, Simulation3DInitializer* init, mpi::communicator & world) : world(world), xLine(world.split(world.rank() / procs_x)), yLine(world.split(world.rank() % procs_x + (world.rank() / (procs_x*procs_y)) * procs_x)), zLine(world.split(world.rank() % (procs_x*procs_y))), nSteps(n_steps), currentStep(0), dx(L_x/n_cells), dy(L_y/n_cells), dz(L_z/n_cells), dt(T/n_steps), blockSize(block_size), preFactorX(LIGHTSPEED*dt/(2*dx)), preFactorY(LIGHTSPEED*dt/(2*dy)), preFactorZ(LIGHTSPEED*dt/(2*dz)), E(new double[3*blockSize*blockSize*blockSize]), B(new double[3*blockSize*blockSize*blockSize]), tmp_field(new double[3*blockSize*blockSize*blockSize]), rhsx(new double[blockSize*blockSize*blockSize]), rhsy(new double[blockSize*blockSize*blockSize]), rhsz(new double[blockSize*blockSize*blockSize]), rhs_ptrs_x(new double*[blockSize*blockSize]), rhs_ptrs_y(new double*[blockSize*blockSize]), rhs_ptrs_z(new double*[blockSize*blockSize]), dumpDir(dump_dir) { procsX = xLine.size(); procsY = yLine.size(); procsZ = zLine.size(); VacuumMatrixInitializer mat_init_x = VacuumMatrixInitializer(dx, dt, blockSize, determineBoundary(xLine)); VacuumMatrixInitializer mat_init_y = VacuumMatrixInitializer(dy, dt, blockSize, determineBoundary(yLine)); VacuumMatrixInitializer mat_init_z = VacuumMatrixInitializer(dz, dt, blockSize, determineBoundary(zLine)); VacuumCouplingInitializer coupling_init_x = VacuumCouplingInitializer(& mat_init_x, blockSize, xLine); VacuumCouplingInitializer coupling_init_y = VacuumCouplingInitializer(& mat_init_y, blockSize, yLine); VacuumCouplingInitializer coupling_init_z = VacuumCouplingInitializer(& mat_init_z, blockSize, zLine); std::vector<AbstractMatrixInitializer*> mat_inits_x(blockSize*blockSize, & mat_init_x); std::vector<AbstractMatrixInitializer*> mat_inits_y(blockSize*blockSize, & mat_init_y); std::vector<AbstractMatrixInitializer*> mat_inits_z(blockSize*blockSize, & mat_init_z); std::vector<AbstractCouplingInitializer*> coupling_inits_x(blockSize*blockSize, & coupling_init_x); std::vector<AbstractCouplingInitializer*> coupling_inits_y(blockSize*blockSize, & coupling_init_y); std::vector<AbstractCouplingInitializer*> coupling_inits_z(blockSize*blockSize, & coupling_init_z); guardB = allocateGuardStorage(); guardE = allocateGuardStorage(); init->setOffsets(xLine, yLine, zLine); initFields(init); xUpdateRHSs = init->initCollection(mat_inits_x, coupling_inits_x, blockSize, xLine); yUpdateRHSs = init->initCollection(mat_inits_y, coupling_inits_y, blockSize, yLine); zUpdateRHSs = init->initCollection(mat_inits_z, coupling_inits_z, blockSize, zLine); guardSendbuf = new double[3*blockSize*blockSize]; }