FixedTopology *buildTopology(Polyhedron_3 polyhedron, std::vector<SimpleEdge_3> &edges, std::vector<Vector_3> &u, std::vector<Vector_3> &U, std::vector<Vector_3> &points, std::vector<double> &h, std::vector<double> &H, std::map<int, int> &indices) { DEBUG_START; buildFacets(polyhedron, edges, U, H, indices); FixedTopology *FT = new FixedTopology(); FT->tangient.resize(2 * edges.size()); FT->incident.resize(U.size()); FT->influent.resize(U.size()); FT->neighbors.resize(2 * edges.size()); buildMainTopology(edges, u, h, points, FT); buildInfluents(edges, FT); buildNeighbors(edges, points, FT); //shortenEdges(points); if (getenv("CHECK_STARTING_POINT")) { //checkConsistencyConstraints(u, h, U, H, points, FT, false); checkConsistencyConstraints(u, h, U, H, points, FT, true); } //printFixedTopology(FT); DEBUG_END; return FT; }
//-------------------------------------------------------------------------------------------------- // run void BasicSPH::run(double time) { double oldTimeStep = _dt; // Run simulation! double timeLeft = time; while (timeLeft > 0.0) { // Run simulation steps buildNeighbors(); computeDensityAndPressure(); addExternalForces(); computeArtificialViscosityForces(); computePressureForces(); // Compute time step if (_useAdaptiveTimeStep) computeTimeStep(); // Limit timestep to the time left in the simulation if (timeLeft < _dt) { _dt = timeLeft; } // Update particles integrate(); // Update time timeLeft -= _dt; std::cout << "Substep done! With timestep = " << _dt << std::endl; } // Restore old time step _dt = oldTimeStep; }