diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/elbeem/intern/solver_init.cpp | 2 | ||||
-rw-r--r-- | intern/smoke/extern/smoke_API.h | 8 | ||||
-rw-r--r-- | intern/smoke/intern/FLUID_3D.cpp | 12 | ||||
-rw-r--r-- | intern/smoke/intern/FLUID_3D.h | 11 | ||||
-rw-r--r-- | intern/smoke/intern/FLUID_3D_SOLVERS.cpp | 5 | ||||
-rw-r--r-- | intern/smoke/intern/FLUID_3D_STATIC.cpp | 17 | ||||
-rw-r--r-- | intern/smoke/intern/IMAGE.h | 15 | ||||
-rw-r--r-- | intern/smoke/intern/WAVELET_NOISE.h | 27 | ||||
-rw-r--r-- | intern/smoke/intern/WTURBULENCE.cpp | 14 | ||||
-rw-r--r-- | intern/smoke/intern/smoke_API.cpp | 11 |
10 files changed, 69 insertions, 53 deletions
diff --git a/intern/elbeem/intern/solver_init.cpp b/intern/elbeem/intern/solver_init.cpp index ce54adb48ee..fee011a70ae 100644 --- a/intern/elbeem/intern/solver_init.cpp +++ b/intern/elbeem/intern/solver_init.cpp @@ -1464,7 +1464,7 @@ void LbmFsgrSolver::initMovingObstacles(bool staticInit) { obj->applyTransformation(targetTime, &mMOIVertices,NULL /* no old normals needed */, 0, mMOIVertices.size(), false ); } else { // only do transform update - obj->getMovingPoints(mMOIVertices,pNormals); + obj->getMovingPoints(mMOIVertices,pNormals); // mMOIVertices = mCachedMovPoints mMOIVerticesOld = mMOIVertices; // WARNING - assumes mSimulationTime is global!? obj->applyTransformation(targetTime, &mMOIVertices,pNormals, 0, mMOIVertices.size(), false ); diff --git a/intern/smoke/extern/smoke_API.h b/intern/smoke/extern/smoke_API.h index 491e065d3ac..e5b2d3deab3 100644 --- a/intern/smoke/extern/smoke_API.h +++ b/intern/smoke/extern/smoke_API.h @@ -32,7 +32,7 @@ extern "C" { #endif -struct FLUID_3D *smoke_init(int *res, int amplify, float *p0, float *p1, float dt); +struct FLUID_3D *smoke_init(int *res, int amplify, float *p0, float dt); void smoke_free(struct FLUID_3D *fluid); void smoke_initBlenderRNA(struct FLUID_3D *fluid, float *alpha, float *beta); @@ -48,8 +48,8 @@ float *smoke_get_velocity_z(struct FLUID_3D *fluid); unsigned char *smoke_get_obstacle(struct FLUID_3D *fluid); -size_t smoke_get_index(int x, int max_x, int y, int max_y, int z, int max_z); -size_t smoke_get_index2d(int x, int max_x, int y, int max_y, int z, int max_z); +size_t smoke_get_index(int x, int max_x, int y, int max_y, int z); +size_t smoke_get_index2d(int x, int max_x, int y); void smoke_set_noise(struct FLUID_3D *fluid, int type); @@ -59,4 +59,4 @@ void smoke_get_bigres(struct FLUID_3D *fluid, int *res); } #endif -#endif /* SMOKE_API_H_ */ +#endif /* SMOKE_API_H_ */
\ No newline at end of file diff --git a/intern/smoke/intern/FLUID_3D.cpp b/intern/smoke/intern/FLUID_3D.cpp index 3427b32e888..2822fca3607 100644 --- a/intern/smoke/intern/FLUID_3D.cpp +++ b/intern/smoke/intern/FLUID_3D.cpp @@ -38,8 +38,8 @@ // Construction/Destruction ////////////////////////////////////////////////////////////////////// -FLUID_3D::FLUID_3D(int *res, int amplify, float *p0, float *p1, float dt) : - _xRes(res[0]), _yRes(res[1]), _zRes(res[2]), _res(0.), _dt(dt) +FLUID_3D::FLUID_3D(int *res, int amplify, float *p0, float dt) : + _xRes(res[0]), _yRes(res[1]), _zRes(res[2]), _res(0.0f), _dt(dt) { // set simulation consts // _dt = dt; // 0.10 @@ -486,9 +486,11 @@ void FLUID_3D::setObstacleBoundaries() const int down = _obstacles[index - _xRes]; const int left = _obstacles[index - 1]; const int right = _obstacles[index + 1]; - const bool fullz = (top && bottom); - const bool fully = (up && down); - const bool fullx = (left && right); + + // unused + // const bool fullz = (top && bottom); + // const bool fully = (up && down); + //const bool fullx = (left && right); _xVelocity[index] = _yVelocity[index] = diff --git a/intern/smoke/intern/FLUID_3D.h b/intern/smoke/intern/FLUID_3D.h index c26ed14406a..2d212caa6d3 100644 --- a/intern/smoke/intern/FLUID_3D.h +++ b/intern/smoke/intern/FLUID_3D.h @@ -37,7 +37,7 @@ class WTURBULENCE; class FLUID_3D { public: - FLUID_3D(int *res, int amplify, float *p0, float *p1, float dt); + FLUID_3D(int *res, int amplify, float *p0, float dt); FLUID_3D() {}; virtual ~FLUID_3D(); @@ -166,11 +166,10 @@ class FLUID_3D float* oldField, float* newField, Vec3Int res, const float* obstacles, const float *oldAdvection); // output helper functions - static void writeImageSliceXY(const float *field, Vec3Int res, int slice, string prefix, int picCnt, float scale=1.); - static void writeImageSliceYZ(const float *field, Vec3Int res, int slice, string prefix, int picCnt, float scale=1.); - static void writeImageSliceXZ(const float *field, Vec3Int res, int slice, string prefix, int picCnt, float scale=1.); - static void writeProjectedIntern(const float *field, Vec3Int res, int dir1, int dir2, string prefix, int picCnt, float scale=1.); + // static void writeImageSliceXY(const float *field, Vec3Int res, int slice, string prefix, int picCnt, float scale=1.); + // static void writeImageSliceYZ(const float *field, Vec3Int res, int slice, string prefix, int picCnt, float scale=1.); + // static void writeImageSliceXZ(const float *field, Vec3Int res, int slice, string prefix, int picCnt, float scale=1.); + // static void writeProjectedIntern(const float *field, Vec3Int res, int dir1, int dir2, string prefix, int picCnt, float scale=1.); }; #endif - diff --git a/intern/smoke/intern/FLUID_3D_SOLVERS.cpp b/intern/smoke/intern/FLUID_3D_SOLVERS.cpp index b628d48b943..5fd8f72d79d 100644 --- a/intern/smoke/intern/FLUID_3D_SOLVERS.cpp +++ b/intern/smoke/intern/FLUID_3D_SOLVERS.cpp @@ -78,7 +78,7 @@ void FLUID_3D::solvePressure(float* field, float* b, unsigned char* skip) deltaNew += _residual[index] * _residual[index]; // delta0 = deltaNew - float delta0 = deltaNew; + // float delta0 = deltaNew; // While deltaNew > (eps^2) * delta0 const float eps = SOLVER_ACCURACY; @@ -225,7 +225,7 @@ void FLUID_3D::solveHeat(float* field, float* b, unsigned char* skip) deltaNew += _residual[index] * _residual[index]; // delta0 = deltaNew - float delta0 = deltaNew; + // float delta0 = deltaNew; // While deltaNew > (eps^2) * delta0 const float eps = SOLVER_ACCURACY; @@ -316,3 +316,4 @@ void FLUID_3D::solveHeat(float* field, float* b, unsigned char* skip) } cout << i << " iterations converged to " << maxR << endl; } + diff --git a/intern/smoke/intern/FLUID_3D_STATIC.cpp b/intern/smoke/intern/FLUID_3D_STATIC.cpp index 7ebe987aaa2..a72009b9abf 100644 --- a/intern/smoke/intern/FLUID_3D_STATIC.cpp +++ b/intern/smoke/intern/FLUID_3D_STATIC.cpp @@ -29,6 +29,7 @@ ////////////////////////////////////////////////////////////////////// // add a test cube of density to the center ////////////////////////////////////////////////////////////////////// +/* void FLUID_3D::addSmokeColumn() { addSmokeTestCase(_density, _res, 1.0); // addSmokeTestCase(_zVelocity, _res, 1.0); @@ -37,11 +38,13 @@ void FLUID_3D::addSmokeColumn() { addSmokeTestCase(_wTurbulence->getDensityBig(), _wTurbulence->getResBig(), 1.0); } } +*/ ////////////////////////////////////////////////////////////////////// // generic static version, so that it can be applied to the // WTURBULENCE grid as well ////////////////////////////////////////////////////////////////////// +/* void FLUID_3D::addSmokeTestCase(float* field, Vec3Int res, float value) { const int slabSize = res[0]*res[1]; int maxRes = (int)MAX3V(res); @@ -69,6 +72,7 @@ void FLUID_3D::addSmokeTestCase(float* field, Vec3Int res, float value) } } } +*/ ////////////////////////////////////////////////////////////////////// // set x direction to Neumann boundary conditions @@ -114,7 +118,7 @@ void FLUID_3D::setNeumannY(float* field, Vec3Int res) for (int x = 0; x < res[0]; x++) { // top slab - int index = x + z * slabSize; + index = x + z * slabSize; index += slabSize - res[0]; if(field[index]<0.) field[index] = 0.; index -= res[0]; @@ -226,7 +230,6 @@ void FLUID_3D::copyBorderX(float* field, Vec3Int res) void FLUID_3D::copyBorderY(float* field, Vec3Int res) { const int slabSize = res[0] * res[1]; - const int totalCells = res[0] * res[1] * res[2]; int index; for (int z = 0; z < res[2]; z++) for (int x = 0; x < res[0]; x++) @@ -265,8 +268,6 @@ void FLUID_3D::advectFieldSemiLagrange(const float dt, const float* velx, const const int xres = res[0]; const int yres = res[1]; const int zres = res[2]; - static int hits = 0; - static int total = 0; const int slabSize = res[0] * res[1]; // scale dt up to grid resolution @@ -615,12 +616,16 @@ static int getOtherDir(int dir1, int dir2) { case 0: return 1; case 1: return 0; } break; + default: + return 0; } + return 0; } ////////////////////////////////////////////////////////////////////// // average densities along third spatial direction ////////////////////////////////////////////////////////////////////// +/* void FLUID_3D::writeProjectedIntern(const float *field, Vec3Int res, int dir1, int dir2, string prefix, int picCnt, float scale) { const int nitems = res[dir1]*res[dir2]; @@ -645,6 +650,8 @@ void FLUID_3D::writeProjectedIntern(const float *field, Vec3Int res, buf[bufindex] += field[index] * scale *div; } } - IMAGE::dumpNumberedPNG(picCnt, prefix, buf, res[dir1], res[dir2]); + // IMAGE::dumpNumberedPNG(picCnt, prefix, buf, res[dir1], res[dir2]); delete[] buf; } +*/ + diff --git a/intern/smoke/intern/IMAGE.h b/intern/smoke/intern/IMAGE.h index 772c0161c66..a57f164509e 100644 --- a/intern/smoke/intern/IMAGE.h +++ b/intern/smoke/intern/IMAGE.h @@ -77,7 +77,8 @@ template < class T > inline float MIN3V( T vec) { #include <png.h> namespace IMAGE { - static int writePng(const char *fileName, unsigned char **rowsp, int w, int h, bool normalize) + /* + static int writePng(const char *fileName, unsigned char **rowsp, int w, int h) { // defaults const int colortype = PNG_COLOR_TYPE_RGBA; @@ -123,13 +124,14 @@ namespace IMAGE { if(png_ptr || info_ptr) png_destroy_write_struct(&png_ptr, &info_ptr); return -1; } + */ ///////////////////////////////////////////////////////////////////////////////// // write a numbered PNG file out, padded with zeros up to three zeros ///////////////////////////////////////////////////////////////////////////////// + /* static void dumpNumberedPNG(int counter, std::string prefix, float* field, int xRes, int yRes) { - /* char buffer[256]; sprintf(buffer,"%04i", counter); std::string number = std::string(buffer); @@ -153,12 +155,13 @@ namespace IMAGE { std::string filenamePNG = prefix + number + std::string(".png"); writePng(filenamePNG.c_str(), rows, xRes, yRes, false); printf("Writing %s\n", filenamePNG.c_str()); - */ + } - +*/ ///////////////////////////////////////////////////////////////////////////////// // export pbrt volumegrid geometry object ///////////////////////////////////////////////////////////////////////////////// + /* static void dumpPBRT(int counter, std::string prefix, float* fieldOrg, int xRes, int yRes, int zRes) { char buffer[256]; @@ -213,10 +216,12 @@ namespace IMAGE { gzclose(file); delete[] field; } + */ ///////////////////////////////////////////////////////////////////////////////// // 3D df3 export ///////////////////////////////////////////////////////////////////////////////// +/* static void dumpDF3(int counter, std::string prefix, float* fieldOrg, int xRes, int yRes, int zRes) { char buffer[256]; @@ -263,8 +268,10 @@ namespace IMAGE { gzclose(file); delete[] buf; } + */ }; #endif + diff --git a/intern/smoke/intern/WAVELET_NOISE.h b/intern/smoke/intern/WAVELET_NOISE.h index 72469c2b231..ccb540f6d4d 100644 --- a/intern/smoke/intern/WAVELET_NOISE.h +++ b/intern/smoke/intern/WAVELET_NOISE.h @@ -223,7 +223,7 @@ static bool loadTile(float* const noiseTileData, std::string filename) int gridSize = noiseTileSize * noiseTileSize * noiseTileSize; // noiseTileData memory is managed by caller - int bread = fread((void*)noiseTileData, sizeof(float), gridSize, file); + size_t bread = fread((void*)noiseTileData, sizeof(float), gridSize, file); fclose(file); printf("Noise tile file '%s' loaded.\n", filename.c_str()); @@ -330,22 +330,22 @@ static void generateTile_WAVELET(float* const noiseTileData, std::string filenam // x derivative of noise ////////////////////////////////////////////////////////////////////////////////////////// static inline float WNoiseDx(Vec3 p, float* data) { - int i, f[3], c[3], mid[3], n = noiseTileSize; + int c[3], mid[3], n = noiseTileSize; float w[3][3], t, result = 0; - mid[0] = ceil(p[0] - 0.5); + mid[0] = (int)ceil(p[0] - 0.5); t = mid[0] - (p[0] - 0.5); w[0][0] = -t; w[0][2] = (1.f - t); w[0][1] = 2.0f * t - 1.0f; - mid[1] = ceil(p[1] - 0.5); + mid[1] = (int)ceil(p[1] - 0.5); t = mid[1] - (p[1] - 0.5); w[1][0] = t * t / 2; w[1][2] = (1 - t) * (1 - t) / 2; w[1][1] = 1 - w[1][0] - w[1][2]; - mid[2] = ceil(p[2] - 0.5); + mid[2] = (int)ceil(p[2] - 0.5); t = mid[2] - (p[2] - 0.5); w[2][0] = t * t / 2; w[2][2] = (1 - t) * (1 - t)/2; @@ -372,22 +372,22 @@ static inline float WNoiseDx(Vec3 p, float* data) { // y derivative of noise ////////////////////////////////////////////////////////////////////////////////////////// static inline float WNoiseDy(Vec3 p, float* data) { - int i, f[3], c[3], mid[3], n=noiseTileSize; + int c[3], mid[3], n=noiseTileSize; float w[3][3], t, result =0; - mid[0] = ceil(p[0] - 0.5); + mid[0] = (int)ceil(p[0] - 0.5); t = mid[0]-(p[0] - 0.5); w[0][0] = t * t / 2; w[0][2] = (1 - t) * (1 - t) / 2; w[0][1] = 1 - w[0][0] - w[0][2]; - mid[1] = ceil(p[1] - 0.5); + mid[1] = (int)ceil(p[1] - 0.5); t = mid[1]-(p[1] - 0.5); w[1][0] = -t; w[1][2] = (1.f - t); w[1][1] = 2.0f * t - 1.0f; - mid[2] = ceil(p[2] - 0.5); + mid[2] = (int)ceil(p[2] - 0.5); t = mid[2] - (p[2] - 0.5); w[2][0] = t * t / 2; w[2][2] = (1 - t) * (1 - t)/2; @@ -415,22 +415,22 @@ static inline float WNoiseDy(Vec3 p, float* data) { // z derivative of noise ////////////////////////////////////////////////////////////////////////////////////////// static inline float WNoiseDz(Vec3 p, float* data) { - int i, f[3], c[3], mid[3], n=noiseTileSize; + int c[3], mid[3], n=noiseTileSize; float w[3][3], t, result =0; - mid[0] = ceil(p[0] - 0.5); + mid[0] = (int)ceil(p[0] - 0.5); t = mid[0]-(p[0] - 0.5); w[0][0] = t * t / 2; w[0][2] = (1 - t) * (1 - t) / 2; w[0][1] = 1 - w[0][0] - w[0][2]; - mid[1] = ceil(p[1] - 0.5); + mid[1] = (int)ceil(p[1] - 0.5); t = mid[1]-(p[1] - 0.5); w[1][0] = t * t / 2; w[1][2] = (1 - t) * (1 - t) / 2; w[1][1] = 1 - w[1][0] - w[1][2]; - mid[2] = ceil(p[2] - 0.5); + mid[2] = (int)ceil(p[2] - 0.5); t = mid[2] - (p[2] - 0.5); w[2][0] = -t; w[2][2] = (1.f - t); @@ -454,3 +454,4 @@ static inline float WNoiseDz(Vec3 p, float* data) { } #endif + diff --git a/intern/smoke/intern/WTURBULENCE.cpp b/intern/smoke/intern/WTURBULENCE.cpp index 05e29442383..022c8f28252 100644 --- a/intern/smoke/intern/WTURBULENCE.cpp +++ b/intern/smoke/intern/WTURBULENCE.cpp @@ -56,7 +56,7 @@ WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify) _strength = 2.; // add the corresponding octaves of noise - _octaves = log((float)_amplify) / log(2.0f); + _octaves = (int)log((float)_amplify) / log(2.0f); // XXX DEBUG/ TODO: int casting correct? - dg // noise resolution _xResBig = _amplify * xResSm; @@ -561,7 +561,7 @@ Vec3 WTURBULENCE::WVelocityWithJacobian(Vec3 orgPos, float* xUnwarped, float* yU final[0] = WNoiseDx(p1, _noiseTile); final[1] = WNoiseDy(p1, _noiseTile); final[2] = WNoiseDz(p1, _noiseTile); - const float f1x = xUnwarped[0] * final[0] + xUnwarped[1] * final[1] + xUnwarped[2] * final[2]; + // UNUSED const float f1x = xUnwarped[0] * final[0] + xUnwarped[1] * final[1] + xUnwarped[2] * final[2]; const float f1y = yUnwarped[0] * final[0] + yUnwarped[1] * final[1] + yUnwarped[2] * final[2]; const float f1z = zUnwarped[0] * final[0] + zUnwarped[1] * final[1] + zUnwarped[2] * final[2]; @@ -569,7 +569,7 @@ Vec3 WTURBULENCE::WVelocityWithJacobian(Vec3 orgPos, float* xUnwarped, float* yU final[1] = WNoiseDy(p2, _noiseTile); final[2] = WNoiseDz(p2, _noiseTile); const float f2x = xUnwarped[0] * final[0] + xUnwarped[1] * final[1] + xUnwarped[2] * final[2]; - const float f2y = yUnwarped[0] * final[0] + yUnwarped[1] * final[1] + yUnwarped[2] * final[2]; + // UNUSED const float f2y = yUnwarped[0] * final[0] + yUnwarped[1] * final[1] + yUnwarped[2] * final[2]; const float f2z = zUnwarped[0] * final[0] + zUnwarped[1] * final[1] + zUnwarped[2] * final[2]; final[0] = WNoiseDx(p3, _noiseTile); @@ -577,7 +577,7 @@ Vec3 WTURBULENCE::WVelocityWithJacobian(Vec3 orgPos, float* xUnwarped, float* yU final[2] = WNoiseDz(p3, _noiseTile); const float f3x = xUnwarped[0] * final[0] + xUnwarped[1] * final[1] + xUnwarped[2] * final[2]; const float f3y = yUnwarped[0] * final[0] + yUnwarped[1] * final[1] + yUnwarped[2] * final[2]; - const float f3z = zUnwarped[0] * final[0] + zUnwarped[1] * final[1] + zUnwarped[2] * final[2]; + // UNUSED const float f3z = zUnwarped[0] * final[0] + zUnwarped[1] * final[1] + zUnwarped[2] * final[2]; Vec3 ret = Vec3( f3y - f2z, @@ -764,8 +764,6 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa { float maxVelMag1 = 0.; #if PARALLEL==1 const int id = omp_get_thread_num(), num = omp_get_num_threads(); -#else - const int id = 0; #endif // vector noise main loop @@ -795,8 +793,11 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa float yWarped[] = {0.0f, 1.0f, 0.0f}; float zWarped[] = {0.0f, 0.0f, 1.0f}; bool nonSingular = LU.isNonsingular(); +#if 0 + // UNUSED float eigMax = 10.0f; float eigMin = 0.1f; +#endif if (nonSingular) { solveLU3x3(LU, xUnwarped, xWarped); @@ -961,3 +962,4 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa _totalStepsBig++; } + diff --git a/intern/smoke/intern/smoke_API.cpp b/intern/smoke/intern/smoke_API.cpp index c81d6fb8c50..cacd58fce13 100644 --- a/intern/smoke/intern/smoke_API.cpp +++ b/intern/smoke/intern/smoke_API.cpp @@ -34,7 +34,7 @@ extern "C" FLUID_3D *smoke_init(int *res, int amplify, float *p0, float *p1, float dt) { // smoke lib uses y as top-bottom/vertical axis where blender uses z - FLUID_3D *fluid = new FLUID_3D(res, amplify, p0, p1, dt); + FLUID_3D *fluid = new FLUID_3D(res, amplify, p0, dt); // printf("xres: %d, yres: %d, zres: %d\n", res[0], res[1], res[2]); @@ -47,7 +47,7 @@ extern "C" void smoke_free(FLUID_3D *fluid) fluid = NULL; } -extern "C" void smoke_step(FLUID_3D *fluid, float dx) +extern "C" void smoke_step(FLUID_3D *fluid) { // fluid->addSmokeColumn(); fluid->step(); @@ -105,13 +105,13 @@ extern "C" unsigned char *smoke_get_obstacle(FLUID_3D *fluid) return fluid->_obstacles; } -extern "C" size_t smoke_get_index(int x, int max_x, int y, int max_y, int z, int max_z) +extern "C" size_t smoke_get_index(int x, int max_x, int y, int max_y, int z /*, int max_z */) { // // const int index = x + y * smd->res[0] + z * smd->res[0]*smd->res[1]; return x + y * max_x + z * max_x*max_y; } -extern "C" size_t smoke_get_index2d(int x, int max_x, int y, int max_y, int z, int max_z) +extern "C" size_t smoke_get_index2d(int x, int max_x, int y /*, int max_y, int z, int max_z */) { return x + y * max_x; } @@ -120,6 +120,3 @@ extern "C" void smoke_set_noise(FLUID_3D *fluid, int type) { fluid->_wTurbulence->setNoise(type); } - - - |