Skip to content

Commit

Permalink
included all sources, cmakefile cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thunil committed Feb 2, 2016
1 parent 5e62873 commit 5182e0a
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 73 deletions.
73 changes: 8 additions & 65 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ SET(SILENT_SOURCES)

# need pre-processing
SET(PP_SOURCES
source/general.cpp
source/fluidsolver.cpp
source/conjugategrad.cpp
source/grid.cpp
source/levelset.cpp
source/fastmarch.cpp
source/shapes.cpp
source/mesh.cpp
source/general.cpp
source/particle.cpp
source/movingobs.cpp
source/fileio.cpp
Expand All @@ -162,6 +162,7 @@ SET(PP_SOURCES
)

SET(PP_HEADERS
source/general.h
source/commonkernels.h
source/conjugategrad.h
source/fastmarch.h
Expand All @@ -173,7 +174,6 @@ SET(PP_HEADERS
source/shapes.h
source/noisefield.h
source/vortexsheet.h
source/general.h
source/kernel.h
source/timing.h
source/movingobs.h
Expand Down Expand Up @@ -250,75 +250,18 @@ SET(INCLUDE_PATHS
${CMAKE_CURRENT_BINARY_DIR}/${PP_PATH}/source
)

# reduced version without python
if (NOPYTHON)
# replace sources
SET(PP_SOURCES
source/general.cpp
source/fluidsolver.cpp
# source/conjugategrad.cpp
# source/grid.cpp
# source/levelset.cpp
# source/fastmarch.cpp
# source/shapes.cpp
# source/mesh.cpp
# source/particle.cpp
# source/movingobs.cpp
# source/fileio.cpp
# source/noisefield.cpp
source/kernel.cpp
# source/vortexsheet.cpp
# source/vortexpart.cpp
# source/turbulencepart.cpp
source/timing.cpp
# source/edgecollapse.cpp
# source/plugin/advection.cpp
# source/plugin/extforces.cpp
# source/plugin/flip.cpp
# source/plugin/kepsilon.cpp
# source/plugin/initplugins.cpp
# source/plugin/meshplugins.cpp
# source/plugin/pressure.cpp
# source/plugin/vortexplugins.cpp
# source/plugin/waveletturbulence.cpp
# source/plugin/waves.cpp
# source/python/defines.py
# source/test.cpp
)

SET(PP_HEADERS
source/nopython/general.h
source/commonkernels.h
# source/conjugategrad.h
# source/fastmarch.h
source/fluidsolver.h
source/grid.h
# source/mesh.h
source/particle.h
# source/levelset.h
# source/shapes.h
# source/noisefield.h
# source/vortexsheet.h
source/general.h
source/kernel.h
source/timing.h
# source/movingobs.h
source/fileio.h
# source/edgecollapse.h
# source/vortexpart.h
# source/turbulencepart.h
)
# replace some of the headers...
LIST( REMOVE_ITEM PP_HEADERS source/general.h)
LIST( APPEND PP_HEADERS source/nopython/general.h)

# fully replace other source lists
set(NOPP_SOURCES
source/nopython/pclass.cpp
# source/pwrapper/pymain.cpp
# source/pwrapper/pclass.cpp
# source/pwrapper/pvec3.cpp
# source/pwrapper/pconvert.cpp
# source/pwrapper/registry.cpp
source/util/vectorbase.cpp
source/util/simpleimage.cpp
)

)
SET(INCLUDE_PATHS
source/nopython
source/cuda
Expand Down
8 changes: 4 additions & 4 deletions source/edgecollapse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ void CollapseEdge(Mesh& m, const int trinum, const int which, const Vec3 &edgeve
do {
// rotate around vertex P1 counter-clockwise
int op = m.corners(m.corners(current).next).opposite;
if (op < 0) throw Error("tube cutting failed, no opposite");
if (op < 0) errMsg("tube cutting failed, no opposite");
current = m.corners(op).next;

if(m.corners(m.corners(current).prev).node==commonVert)
Expand All @@ -443,15 +443,15 @@ void CollapseEdge(Mesh& m, const int trinum, const int which, const Vec3 &edgeve
do {
// rotate around vertex P0 clockwise
int op = m.corners(m.corners(current).prev).opposite;
if (op < 0) throw Error("tube cutting failed, no opposite");
if (op < 0) errMsg("tube cutting failed, no opposite");

current = m.corners(op).prev;
if(m.corners(m.corners(current).next).node==commonVert)
P2P0 = m.corners(current).prev;
} while(current != end);

if (P1P2 < 0 || P2P0 < 0)
throw Error("tube cutting failed, ill geometry");
errMsg("tube cutting failed, ill geometry");

P2P1 = m.corners(P1P2).opposite;
P0P2 = m.corners(P2P0).opposite;
Expand Down Expand Up @@ -663,4 +663,4 @@ void CollapseEdge(Mesh& m, const int trinum, const int which, const Vec3 &edgeve
numCollapses++;
}

} // namespace
} // namespace
2 changes: 1 addition & 1 deletion source/fastmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ inline Real FastMarch<COMP,TDIR>::calculateDistance(const Vec3i& idx) {
ret = v[0]+ (Real)(TDIR) ; // direction = +- 1
} break;
default:
throw Error("FastMarch :: Invalid invcnt");
errMsg("FastMarch :: Invalid invcnt");
break;
}
return ret;
Expand Down
6 changes: 3 additions & 3 deletions source/fluidsolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ FluidSolver::~FluidSolver() {
}

PbClass* FluidSolver::create(PbType t, PbTypeVec T, const string& name) {
#if NOPYTHON!=1
# if NOPYTHON!=1
_args.add("nocheck",true);
if (t.str() == "")
errMsg("Need to specify object type. Use e.g. Solver.create(FlagGrid, ...) or Solver.create(type=FlagGrid, ...)");

PbClass* ret = PbClass::createPyObject(t.str() + T.str(), name, _args, this);
#else
# else
PbClass* ret = NULL;
#endif
# endif
return ret;
}

Expand Down
4 changes: 4 additions & 0 deletions source/mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ void Mesh::applyMeshToGrid(GridBase* grid, FlagGrid* respectFlags, Real cutoff)
LevelsetGrid mesh_sdf(&dummy, false);
meshSDF(*this, mesh_sdf, 2., cutoff);

# if NOPYTHON!=1
if (grid->getType() & GridBase::TypeInt)
ApplyMeshToGrid<int> ((Grid<int>*)grid, mesh_sdf, _args.get<int>("value"), respectFlags);
else if (grid->getType() & GridBase::TypeReal)
Expand All @@ -681,6 +682,9 @@ void Mesh::applyMeshToGrid(GridBase* grid, FlagGrid* respectFlags, Real cutoff)
ApplyMeshToGrid<Vec3> ((Grid<Vec3>*)grid, mesh_sdf, _args.get<Vec3>("value"), respectFlags);
else
errMsg("Shape::applyToGrid(): unknown grid type");
# else
errMsg("Not yet supported...");
# endif
}

void Mesh::computeLevelset(LevelsetGrid& levelset, Real sigma, Real cutoff) {
Expand Down
4 changes: 4 additions & 0 deletions source/movingobs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,13 @@ void MovingObstacle::moveLinear(Real t, Real t0, Real t1, Vec3 p0, Vec3 p1, Flag
}
// apply new flags
for (size_t i=0; i<mShapes.size(); i++) {
# if NOPYTHON!=1
mShapes[i]->_args.clear();
mShapes[i]->_args.add("value", FlagGrid::TypeObstacle | mID);
mShapes[i]->applyToGrid(&flags, 0);
# else
errMsg("Not yet supported...");
# endif
}
// apply velocities
FOR_IJK_BND(flags,1) {
Expand Down
1 change: 1 addition & 0 deletions source/noisefield.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "vectorbase.h"
#include "manta.h"
#include "grid.h"

namespace Manta {

Expand Down
4 changes: 4 additions & 0 deletions source/particle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ void ParticleBase::deregister(ParticleDataBase* pdata) {

// create and attach a new pdata field to this particle system
PbClass* ParticleBase::create(PbType t, PbTypeVec T, const string& name) {
# if NOPYTHON!=1
_args.add("nocheck",true);
if (t.str() == "")
errMsg("Specify particle data type to create");
Expand All @@ -90,6 +91,9 @@ PbClass* ParticleBase::create(PbType t, PbTypeVec T, const string& name) {

// directly init size of new pdata field:
pdata->resize( this->getSizeSlow() );
# else
PbClass* pyObj = NULL;
# endif
return pyObj;
}

Expand Down
8 changes: 8 additions & 0 deletions source/shapes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ KERNEL() void ApplyShapeToMACGrid (MACGrid* grid, Shape* shape, Vec3 value, Flag
}

void Shape::applyToGrid(GridBase* grid, FlagGrid* respectFlags) {
# if NOPYTHON!=1
if (grid->getType() & GridBase::TypeInt)
ApplyShapeToGrid<int> ((Grid<int>*)grid, this, _args.get<int>("value"), respectFlags);
else if (grid->getType() & GridBase::TypeReal)
Expand All @@ -79,12 +80,16 @@ void Shape::applyToGrid(GridBase* grid, FlagGrid* respectFlags) {
ApplyShapeToGrid<Vec3> ((Grid<Vec3>*)grid, this, _args.get<Vec3>("value"), respectFlags);
else
errMsg("Shape::applyToGrid(): unknown grid type");
# else
errMsg("Not yet supported...");
# endif
}

void Shape::applyToGridSmooth(GridBase* grid, Real sigma, Real shift, FlagGrid* respectFlags) {
Grid<Real> phi(grid->getParent());
generateLevelset(phi);

# if NOPYTHON!=1
if (grid->getType() & GridBase::TypeInt)
ApplyShapeToGridSmooth<int> ((Grid<int>*)grid, phi, sigma, shift, _args.get<int>("value"), respectFlags);
else if (grid->getType() & GridBase::TypeReal)
Expand All @@ -93,6 +98,9 @@ void Shape::applyToGridSmooth(GridBase* grid, Real sigma, Real shift, FlagGrid*
ApplyShapeToGridSmooth<Vec3> ((Grid<Vec3>*)grid, phi, sigma, shift, _args.get<Vec3>("value"), respectFlags);
else
errMsg("Shape::applyToGridSmooth(): unknown grid type");
# else
errMsg("Not yet supported...");
# endif
}

void Shape::collideMesh(Mesh& mesh) {
Expand Down

0 comments on commit 5182e0a

Please sign in to comment.