forked from bartvdbraak/blender
- hopefully fixed osx compilation by forcing compilation
with a single file again (intern/elbeem/intern/solver_main.cpp includes intern/elbeem/intern/solver_init.cpp and intern/elbeem/intern/solver_util.cpp when __APPLE_CC__ is defined) - minor cleanup of inlined functions
This commit is contained in:
parent
5d291535c6
commit
d348027499
@ -363,7 +363,7 @@ typedef union YYSTYPE {
|
||||
char *charValue;
|
||||
} YYSTYPE;
|
||||
/* Line 190 of yacc.c. */
|
||||
#line 367 "bld-std-gcc40/src/cfgparser.cpp"
|
||||
#line 367 "bld-std-gcc/src/cfgparser.cpp"
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
@ -375,7 +375,7 @@ typedef union YYSTYPE {
|
||||
|
||||
|
||||
/* Line 213 of yacc.c. */
|
||||
#line 379 "bld-std-gcc40/src/cfgparser.cpp"
|
||||
#line 379 "bld-std-gcc/src/cfgparser.cpp"
|
||||
|
||||
#if ! defined (yyoverflow) || YYERROR_VERBOSE
|
||||
|
||||
@ -2101,7 +2101,7 @@ yyreduce:
|
||||
}
|
||||
|
||||
/* Line 1037 of yacc.c. */
|
||||
#line 2105 "bld-std-gcc40/src/cfgparser.cpp"
|
||||
#line 2105 "bld-std-gcc/src/cfgparser.cpp"
|
||||
|
||||
yyvsp -= yylen;
|
||||
yyssp -= yylen;
|
||||
|
@ -249,7 +249,7 @@ typedef union YYSTYPE {
|
||||
char *charValue;
|
||||
} YYSTYPE;
|
||||
/* Line 1318 of yacc.c. */
|
||||
#line 253 "bld-std-gcc40/src/cfgparser.hpp"
|
||||
#line 253 "bld-std-gcc/src/cfgparser.hpp"
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
|
@ -20,6 +20,14 @@
|
||||
#include <ieeefp.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
template class vector<IsoLevelVertex>;
|
||||
template class vector<int>;
|
||||
template class vector<unsigned int>;
|
||||
template class vector<float>;
|
||||
template class vector<ntlVec3Gfx>;
|
||||
template class vector< vector<int> >;
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Constructor
|
||||
@ -161,13 +169,13 @@ void IsoSurface::triangulate( void )
|
||||
|
||||
// let the cubes march
|
||||
pz = mStart[2]-gsz;
|
||||
for(int k=0;k<(mSizez-2);k++) {
|
||||
for(int k=1;k<(mSizez-2);k++) {
|
||||
pz += gsz;
|
||||
py = mStart[1]-gsy;
|
||||
for(int j=0;j<(mSizey-2);j++) {
|
||||
for(int j=1;j<(mSizey-2);j++) {
|
||||
py += gsy;
|
||||
px = mStart[0]-gsx;
|
||||
for(int i=0;i<(mSizex-2);i++) {
|
||||
for(int i=1;i<(mSizex-2);i++) {
|
||||
px += gsx;
|
||||
int baseIn = ISOLEVEL_INDEX( i+0, j+0, k+0);
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "ntl_geometryobject.h"
|
||||
#include "ntl_bsptree.h"
|
||||
|
||||
#define ISO_STRICT_DEBUG 0
|
||||
#define ISOSTRICT_EXIT *((int *)0)=0;
|
||||
|
||||
/* access some 3d array */
|
||||
#define ISOLEVEL_INDEX(ii,ij,ik) ((mSizex*mSizey*(ik))+(mSizex*(ij))+((ii)))
|
||||
@ -105,8 +107,10 @@ class IsoSurface :
|
||||
|
||||
//! set geometry start (for renderer)
|
||||
void setStart(ntlVec3Gfx set) { mStart = set; };
|
||||
ntlVec3Gfx getStart() { return mStart; };
|
||||
//! set geometry end (for renderer)
|
||||
void setEnd(ntlVec3Gfx set) { mEnd = set; };
|
||||
ntlVec3Gfx getEnd() { return mEnd; };
|
||||
//! set iso level value for surface reconstruction
|
||||
inline void setIsolevel(double set) { mIsoValue = set; };
|
||||
//! set loop subdiv num
|
||||
@ -124,8 +128,33 @@ class IsoSurface :
|
||||
|
||||
//! access data array
|
||||
inline float* getData(){ return mpData; }
|
||||
inline float* getData(int i, int j, int k){ return mpData + ISOLEVEL_INDEX(i,j,k); }
|
||||
inline float* lbmGetData(int i, int j, int k){ return mpData + ISOLEVEL_INDEX(i+1,j+1,k+1); }
|
||||
inline float* getData(int ii, int jj, int kk){
|
||||
#if ISO_STRICT_DEBUG==1
|
||||
if(ii<0){ errMsg("IsoStrict"," invX- |"<<ii<<","<<jj<<","<<kk); ISOSTRICT_EXIT; }
|
||||
if(jj<0){ errMsg("IsoStrict"," invY- |"<<ii<<","<<jj<<","<<kk); ISOSTRICT_EXIT; }
|
||||
if(kk<0){ errMsg("IsoStrict"," invZ- |"<<ii<<","<<jj<<","<<kk); ISOSTRICT_EXIT; }
|
||||
if(ii>mSizex-1){ errMsg("IsoStrict"," invX+ |"<<ii<<","<<jj<<","<<kk); ISOSTRICT_EXIT; }
|
||||
if(jj>mSizey-1){ errMsg("IsoStrict"," invY+ |"<<ii<<","<<jj<<","<<kk); ISOSTRICT_EXIT; }
|
||||
if(kk>mSizez-1){ errMsg("IsoStrict"," invZ+ |"<<ii<<","<<jj<<","<<kk); ISOSTRICT_EXIT; }
|
||||
return mpData + ISOLEVEL_INDEX(ii, jj, kk);
|
||||
#else //ISO_STRICT_DEBUG==1
|
||||
return mpData + ISOLEVEL_INDEX(ii, jj, kk);
|
||||
#endif
|
||||
}
|
||||
inline float* lbmGetData(int ii, int jj, int kk){
|
||||
#if ISO_STRICT_DEBUG==1
|
||||
ii++; jj++; kk++;
|
||||
if(ii<0){ errMsg("IsoStrict"," invX- |"<<ii<<","<<jj<<","<<kk); ISOSTRICT_EXIT; }
|
||||
if(jj<0){ errMsg("IsoStrict"," invY- |"<<ii<<","<<jj<<","<<kk); ISOSTRICT_EXIT; }
|
||||
if(kk<0){ errMsg("IsoStrict"," invZ- |"<<ii<<","<<jj<<","<<kk); ISOSTRICT_EXIT; }
|
||||
if(ii>mSizex-1){ errMsg("IsoStrict"," invX+ |"<<ii<<","<<jj<<","<<kk); ISOSTRICT_EXIT; }
|
||||
if(jj>mSizey-1){ errMsg("IsoStrict"," invY+ |"<<ii<<","<<jj<<","<<kk); ISOSTRICT_EXIT; }
|
||||
if(kk>mSizez-1){ errMsg("IsoStrict"," invZ+ |"<<ii<<","<<jj<<","<<kk); ISOSTRICT_EXIT; }
|
||||
return mpData + ISOLEVEL_INDEX(ii, jj, kk);
|
||||
#else //ISO_STRICT_DEBUG==1
|
||||
return mpData + ISOLEVEL_INDEX(ii+1,jj+1,kk+1);
|
||||
#endif
|
||||
}
|
||||
|
||||
//! OpenGL viz "interface"
|
||||
unsigned int getIsoVertexCount() {
|
||||
@ -153,7 +182,6 @@ class IsoSurface :
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define ISOSURFACE_H
|
||||
#endif
|
||||
|
||||
|
@ -143,6 +143,14 @@ void ParticleTracer::getTriangles( vector<ntlTriangle> *triangles,
|
||||
vector<ntlVec3Gfx> *vertices,
|
||||
vector<ntlVec3Gfx> *normals, int objectId )
|
||||
{
|
||||
#ifdef ELBEEM_BLENDER
|
||||
// suppress warnings...
|
||||
vertices = NULL; triangles = NULL;
|
||||
normals = NULL; objectId = 0;
|
||||
#else // ELBEEM_BLENDER
|
||||
// currently not used in blender
|
||||
|
||||
const bool debugParts = false;
|
||||
int tris = 0;
|
||||
gfxReal partNormSize = 0.01 * mPartScale;
|
||||
ntlVec3Gfx pScale = ntlVec3Gfx(
|
||||
@ -150,7 +158,7 @@ void ParticleTracer::getTriangles( vector<ntlTriangle> *triangles,
|
||||
(mEnd[1]-mStart[1])/(mSimEnd[1]-mSimStart[1]),
|
||||
(mEnd[2]-mStart[2])/(mSimEnd[2]-mSimStart[2])
|
||||
);
|
||||
//errMsg(" PS ", " S "<<pScale );
|
||||
if(debugParts) errMsg("DebugParts"," geo:"<< mSimStart<<","<<mEnd<<"; sim:"<<mSimStart<<","<<mSimEnd<<"; S "<<pScale );
|
||||
ntlVec3Gfx org = mStart;
|
||||
int segments = mPartSegments;
|
||||
|
||||
@ -158,9 +166,6 @@ void ParticleTracer::getTriangles( vector<ntlTriangle> *triangles,
|
||||
int loldst = mTrailLength-2;
|
||||
// trails gehen nicht so richtig mit der
|
||||
// richtung der partikel...
|
||||
//for(int l=0; l<mTrailLength-2; l++) {
|
||||
//int lnewst = l+1;
|
||||
//int loldst = l;
|
||||
|
||||
for(size_t i=0; i<mParts[lnewst].size(); i++) {
|
||||
|
||||
@ -176,7 +181,7 @@ void ParticleTracer::getTriangles( vector<ntlTriangle> *triangles,
|
||||
if( plen < 1e-05) pdir = ntlVec3Gfx(-1.0 ,0.0 ,0.0);
|
||||
ntlVec3Gfx p = org + pnew*pScale;
|
||||
gfxReal partsize = 0.0;
|
||||
//errMsg("pp"," "<<l<<" i"<<i<<" new"<<pnew<<" old"<<pold );
|
||||
if(debugParts) errMsg("DebugParts"," i"<<i<<" new"<<pnew<<" old"<<pold );
|
||||
|
||||
// value length scaling?
|
||||
if(mValueScale==1) {
|
||||
@ -263,6 +268,7 @@ void ParticleTracer::getTriangles( vector<ntlTriangle> *triangles,
|
||||
debugOut("ParticleTracer::getTriangles "<<mName<<" : Triangulated "<< (mParts[0].size()) <<" particles (triangles: "<<tris<<") ", 10);
|
||||
//debugOut(" s"<<mStart<<" e"<<mEnd<<" ss"<<mSimStart<<" se"<<mSimEnd , 10);
|
||||
|
||||
#endif // ELBEEM_BLENDER
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,7 +10,8 @@
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#ifndef LBMFSGRSOLVER_H
|
||||
#ifndef LBM_SOLVERCLASS_H
|
||||
#define LBM_SOLVERCLASS_H
|
||||
|
||||
// blender interface
|
||||
#if ELBEEM_BLENDER==1
|
||||
@ -124,6 +125,7 @@ ERROR - define model first!
|
||||
// border for marching cubes
|
||||
#define ISOCORR 3
|
||||
|
||||
#define LBM_INLINED inline
|
||||
|
||||
// sirdude fix for solaris
|
||||
#if !defined(linux) && (defined (__sparc) || defined (__sparc__))
|
||||
@ -133,6 +135,9 @@ ERROR - define model first!
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ELBEEM_BLENDER!=1
|
||||
#include "solver_test.h"
|
||||
#endif // ELBEEM_BLENDER==1
|
||||
|
||||
/*****************************************************************************/
|
||||
/*! cell access classes */
|
||||
@ -231,7 +236,7 @@ class LbmFsgrSolver :
|
||||
//! Destructor
|
||||
virtual ~LbmFsgrSolver();
|
||||
//! id string of solver
|
||||
virtual string getIdString() { return string("FsgrSolver[") + D::getIdString(); }
|
||||
virtual string getIdString();
|
||||
|
||||
//! initilize variables fom attribute list
|
||||
virtual void parseAttrList();
|
||||
@ -276,12 +281,11 @@ class LbmFsgrSolver :
|
||||
void initStandingFluidGradient();
|
||||
|
||||
/*! init a given cell with flag, density, mass and equilibrium dist. funcs */
|
||||
inline void initEmptyCell(int level, int i,int j,int k, CellFlagType flag, LbmFloat rho, LbmFloat mass);
|
||||
inline void initVelocityCell(int level, int i,int j,int k, CellFlagType flag, LbmFloat rho, LbmFloat mass, LbmVec vel);
|
||||
inline void changeFlag(int level, int xx,int yy,int zz,int set,CellFlagType newflag);
|
||||
LBM_INLINED void initEmptyCell(int level, int i,int j,int k, CellFlagType flag, LbmFloat rho, LbmFloat mass);
|
||||
LBM_INLINED void initVelocityCell(int level, int i,int j,int k, CellFlagType flag, LbmFloat rho, LbmFloat mass, LbmVec vel);
|
||||
LBM_INLINED void changeFlag(int level, int xx,int yy,int zz,int set,CellFlagType newflag);
|
||||
|
||||
/*! perform a single LBM step */
|
||||
virtual void step() { stepMain(); }
|
||||
void stepMain();
|
||||
void fineAdvance();
|
||||
void coarseAdvance(int lev);
|
||||
@ -293,6 +297,8 @@ class LbmFsgrSolver :
|
||||
void interpolateFineFromCoarse(int lev,LbmFloat t);
|
||||
void coarseRestrictFromFine(int lev);
|
||||
|
||||
/* simulation object interface, just calls stepMain */
|
||||
virtual void step();
|
||||
/*! init particle positions */
|
||||
virtual int initParticles(ParticleTracer *partt);
|
||||
/*! move all particles */
|
||||
@ -332,26 +338,15 @@ class LbmFsgrSolver :
|
||||
//! mass dist weights
|
||||
LbmFloat getMassdWeight(bool dirForw, int i,int j,int k,int workSet, int l);
|
||||
//! add point to mListNewInter list
|
||||
inline void addToNewInterList( int ni, int nj, int nk );
|
||||
LBM_INLINED void addToNewInterList( int ni, int nj, int nk );
|
||||
//! cell is interpolated from coarse level (inited into set, source sets are determined by t)
|
||||
// inline, test?
|
||||
void interpolateCellFromCoarse(int lev, int i, int j,int k, int dstSet, LbmFloat t, CellFlagType flagSet,bool markNbs);
|
||||
|
||||
//! minimal and maximal z-coords (for 2D/3D loops)
|
||||
int getForZMinBnd() { return 0; }
|
||||
int getForZMin1() {
|
||||
if(D::cDimension==2) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int getForZMaxBnd(int lev) {
|
||||
if(D::cDimension==2) return 1;
|
||||
return mLevel[lev].lSizez -0;
|
||||
}
|
||||
int getForZMax1(int lev) {
|
||||
if(D::cDimension==2) return 1;
|
||||
return mLevel[lev].lSizez -1;
|
||||
}
|
||||
LBM_INLINED int getForZMinBnd();
|
||||
LBM_INLINED int getForZMin1();
|
||||
LBM_INLINED int getForZMaxBnd(int lev);
|
||||
LBM_INLINED int getForZMax1(int lev);
|
||||
|
||||
|
||||
// member vars
|
||||
@ -473,6 +468,13 @@ class LbmFsgrSolver :
|
||||
//! debug function to force tadap syncing
|
||||
int mForceTadapRefine;
|
||||
|
||||
#if ELBEEM_BLENDER!=1
|
||||
// test functions
|
||||
LbmTestdata *mpTest;
|
||||
void initTestdata();
|
||||
void destroyTestdata();
|
||||
void handleTestdata();
|
||||
#endif // ELBEEM_BLENDER==1
|
||||
|
||||
// strict debug interface
|
||||
# if FSGR_STRICT_DEBUG==1
|
||||
@ -636,6 +638,7 @@ class LbmFsgrSolver :
|
||||
// relaxation_macros end
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* init a given cell with flag, density, mass and equilibrium dist. funcs */
|
||||
|
||||
@ -684,7 +687,29 @@ LbmFsgrSolver<D>::initVelocityCell(int level, int i,int j,int k, CellFlagType fl
|
||||
return;
|
||||
}
|
||||
|
||||
#define LBMFSGRSOLVER_H
|
||||
template<class D>
|
||||
int LbmFsgrSolver<D>::getForZMinBnd() {
|
||||
return 0;
|
||||
}
|
||||
template<class D>
|
||||
int LbmFsgrSolver<D>::getForZMin1() {
|
||||
if(D::cDimension==2) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
template<class D>
|
||||
int LbmFsgrSolver<D>::getForZMaxBnd(int lev) {
|
||||
if(D::cDimension==2) return 1;
|
||||
return mLevel[lev].lSizez -0;
|
||||
}
|
||||
template<class D>
|
||||
int LbmFsgrSolver<D>::getForZMax1(int lev) {
|
||||
if(D::cDimension==2) return 1;
|
||||
return mLevel[lev].lSizez -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -7,9 +7,12 @@
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __APPLE_CC__
|
||||
#include "solver_class.h"
|
||||
#include "solver_relax.h"
|
||||
#endif // __APPLE_CC__
|
||||
|
||||
#if !defined(__APPLE_CC__) || defined(LBM_FORCEINCLUDE)
|
||||
|
||||
/******************************************************************************
|
||||
* Lbm Constructor
|
||||
@ -124,6 +127,10 @@ LbmFsgrSolver<D>::~LbmFsgrSolver()
|
||||
delete D::mpIso;
|
||||
if(mpPreviewSurface) delete mpPreviewSurface;
|
||||
|
||||
#if ELBEEM_BLENDER!=1
|
||||
destroyTestdata();
|
||||
#endif // ELBEEM_BLENDER!=1
|
||||
|
||||
// always output performance estimate
|
||||
debMsgStd("LbmFsgrSolver::~LbmFsgrSolver",DM_MSG," Avg. MLSUPS:"<<(mAvgMLSUPS/mAvgMLSUPSCnt), 5);
|
||||
if(!D::mSilent) debMsgStd("LbmFsgrSolver::~LbmFsgrSolver",DM_MSG,"Deleted...",10);
|
||||
@ -564,6 +571,14 @@ LbmFsgrSolver<D>::initialize( ntlTree* /*tree*/, vector<ntlGeometryObject*>* /*o
|
||||
initEmptyCell(mMaxRefine, i,mLevel[mMaxRefine].lSizey-1,k, domainBoundType, 0.0, BND_FILL);
|
||||
}
|
||||
|
||||
for(int k=0;k<mLevel[mMaxRefine].lSizez;k++)
|
||||
for(int j=0;j<mLevel[mMaxRefine].lSizey;j++) {
|
||||
initEmptyCell(mMaxRefine, 0,j,k, domainBoundType, 0.0, BND_FILL);
|
||||
initEmptyCell(mMaxRefine, mLevel[mMaxRefine].lSizex-1,j,k, domainBoundType, 0.0, BND_FILL);
|
||||
// DEBUG BORDER!
|
||||
//initEmptyCell(mMaxRefine, mLevel[mMaxRefine].lSizex-2,j,k, domainBoundType, 0.0, BND_FILL);
|
||||
}
|
||||
|
||||
if(D::cDimension == 3) {
|
||||
// only for 3D
|
||||
for(int j=0;j<mLevel[mMaxRefine].lSizey;j++)
|
||||
@ -573,14 +588,6 @@ LbmFsgrSolver<D>::initialize( ntlTree* /*tree*/, vector<ntlGeometryObject*>* /*o
|
||||
}
|
||||
}
|
||||
|
||||
for(int k=0;k<mLevel[mMaxRefine].lSizez;k++)
|
||||
for(int j=0;j<mLevel[mMaxRefine].lSizey;j++) {
|
||||
initEmptyCell(mMaxRefine, 0,j,k, domainBoundType, 0.0, BND_FILL);
|
||||
initEmptyCell(mMaxRefine, mLevel[mMaxRefine].lSizex-1,j,k, domainBoundType, 0.0, BND_FILL);
|
||||
// DEBUG BORDER!
|
||||
//initEmptyCell(mMaxRefine, mLevel[mMaxRefine].lSizex-2,j,k, domainBoundType, 0.0, BND_FILL);
|
||||
}
|
||||
|
||||
// TEST!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11
|
||||
/*for(int k=0;k<mLevel[mMaxRefine].lSizez;k++)
|
||||
for(int j=0;j<mLevel[mMaxRefine].lSizey;j++) {
|
||||
@ -978,6 +985,7 @@ LbmFsgrSolver<D>::initGeometryFlags() {
|
||||
}
|
||||
} // zmax, k
|
||||
// */
|
||||
thinHit = false;
|
||||
|
||||
|
||||
// now init fluid layer
|
||||
@ -1018,6 +1026,9 @@ LbmFsgrSolver<D>::initGeometryFlags() {
|
||||
}
|
||||
} // zmax
|
||||
|
||||
#if ELBEEM_BLENDER!=1
|
||||
initTestdata();
|
||||
#endif // ELBEEM_BLENDER!=1
|
||||
D::freeGeoTree();
|
||||
myTime_t geotimeend = getTime();
|
||||
debMsgStd("LbmFsgrSolver::initGeometryFlags",DM_MSG,"Geometry init done ("<< ((geotimeend-geotimestart)/(double)1000.0)<<"s,"<<savedNodes<<") " , 10 );
|
||||
@ -1353,7 +1364,7 @@ LbmFsgrSolver<D>::initStandingFluidGradient() {
|
||||
mLevel[lev].setOther = mLevel[lev].setCurr;
|
||||
mLevel[lev].setCurr ^= 1;
|
||||
}
|
||||
//D::mInitDone = 0; // GRAVTEST
|
||||
//D::mInitDone = 0; // GRAVTEST
|
||||
// */
|
||||
|
||||
myTime_t timeend = getTime();
|
||||
@ -1440,10 +1451,31 @@ LbmFsgrSolver<D>::checkSymmetry(string idstring)
|
||||
return symm;
|
||||
}// */
|
||||
|
||||
#endif // !defined(__APPLE_CC__) || defined(LBM_FORCEINCLUDE)
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* instantiation
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __APPLE_CC__
|
||||
|
||||
#if LBMDIM==2
|
||||
template class LbmFsgrSolver< LbmBGK2D >;
|
||||
#define LBM_INSTANTIATE LbmBGK2D
|
||||
#endif // LBMDIM==2
|
||||
#if LBMDIM==3
|
||||
template class LbmFsgrSolver< LbmBGK3D >;
|
||||
#define LBM_INSTANTIATE LbmBGK3D
|
||||
#endif // LBMDIM==3
|
||||
|
||||
template class LbmFsgrSolver< LBM_INSTANTIATE >;
|
||||
|
||||
#endif // __APPLE_CC__
|
||||
|
||||
// the intel compiler is too smart - so the virtual functions called from other cpp
|
||||
// files have to be instantiated explcitly (otherwise this will cause undefined
|
||||
// references to "non virtual thunks") ... still not working, though
|
||||
//template<class LBM_INSTANTIATE> LbmFsgrSolver<LBM_INSTANTIATE>::~LbmFsgrSolver();
|
||||
//template<class LBM_INSTANTIATE> void LbmFsgrSolver<LBM_INSTANTIATE>::parseAttrList();
|
||||
//template<class LBM_INSTANTIATE> bool LbmFsgrSolver<LBM_INSTANTIATE>::initialize( ntlTree* /*tree*/, vector<ntlGeometryObject*>* /*objects*/ );
|
||||
|
||||
|
||||
|
@ -10,22 +10,19 @@
|
||||
#include "solver_class.h"
|
||||
#include "solver_relax.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/*! debug object display */
|
||||
/*****************************************************************************/
|
||||
template<class D>
|
||||
vector<ntlGeometryObject*> LbmFsgrSolver<D>::getDebugObjects() {
|
||||
vector<ntlGeometryObject*> debo;
|
||||
if(mOutputSurfacePreview) {
|
||||
debo.push_back( mpPreviewSurface );
|
||||
}
|
||||
return debo;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*! perform a single LBM step */
|
||||
/*****************************************************************************/
|
||||
|
||||
template<class D>
|
||||
string LbmFsgrSolver<D>::getIdString() {
|
||||
return string("FsgrSolver[") + D::getIdString();
|
||||
}
|
||||
template<class D>
|
||||
void LbmFsgrSolver<D>::step() {
|
||||
stepMain();
|
||||
}
|
||||
|
||||
template<class D>
|
||||
void
|
||||
LbmFsgrSolver<D>::stepMain()
|
||||
@ -237,6 +234,9 @@ LbmFsgrSolver<D>::stepMain()
|
||||
fclose(file);
|
||||
} // */
|
||||
|
||||
#if ELBEEM_BLENDER!=1
|
||||
handleTestdata();
|
||||
#endif // ELBEEM_BLENDER!=1
|
||||
}
|
||||
|
||||
template<class D>
|
||||
@ -919,6 +919,7 @@ LbmFsgrSolver<D>::mainLoop(int lev)
|
||||
|
||||
// check other vars...?
|
||||
}
|
||||
#undef NBFLAG
|
||||
|
||||
template<class D>
|
||||
void
|
||||
@ -2664,6 +2665,19 @@ void LbmFsgrSolver<D>::reinitFlags( int workSet )
|
||||
} // reinitFlags
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* instantiation
|
||||
*****************************************************************************/
|
||||
|
||||
// ugly workaround for multiple definitions
|
||||
// of template instatiations for macs... compile
|
||||
// everything in one file again
|
||||
#if defined(__APPLE_CC__)
|
||||
#define LBM_FORCEINCLUDE
|
||||
#include "solver_init.cpp"
|
||||
#include "solver_util.cpp"
|
||||
#undef LBM_FORCEINCLUDE
|
||||
#endif // defined(__APPLE_CC__)
|
||||
|
||||
//! lbm factory functions
|
||||
LbmSolverInterface* createSolver() {
|
||||
@ -2676,9 +2690,19 @@ LbmSolverInterface* createSolver() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#if LBMDIM==2
|
||||
template class LbmFsgrSolver< LbmBGK2D >;
|
||||
#define LBM_INSTANTIATE LbmBGK2D
|
||||
#endif // LBMDIM==2
|
||||
#if LBMDIM==3
|
||||
template class LbmFsgrSolver< LbmBGK3D >;
|
||||
#define LBM_INSTANTIATE LbmBGK3D
|
||||
#endif // LBMDIM==3
|
||||
|
||||
template class LbmFsgrSolver< LBM_INSTANTIATE >;
|
||||
// the intel compiler is too smart - so the virtual functions called from other cpp
|
||||
// files have to be instantiated explcitly (otherwise this will cause undefined
|
||||
// references to "non virtual thunks") ... still not working, though
|
||||
//template<class LBM_INSTANTIATE> string LbmFsgrSolver<LBM_INSTANTIATE>::getIdString();
|
||||
//template<class LBM_INSTANTIATE> void LbmFsgrSolver<LBM_INSTANTIATE>::step();
|
||||
|
||||
|
||||
|
@ -348,7 +348,7 @@
|
||||
} else {\
|
||||
m[l] = newval; /* normal free slip*/\
|
||||
}\
|
||||
/*if(RFLAG(lev, i,j,k, SRCS(lev))&CFInter) errMsg("FS","at "<<PRINT_IJK<<",l"<<l<<" nb1"<<nb1<<" nb2"<<nb2<<" dx"<<PRINT_VEC(dx,dy,dz)<<",srcl"<<debug_srcl<<" -> "<<newval );/**/ \
|
||||
/*if(RFLAG(lev, i,j,k, SRCS(lev))&CFInter) errMsg("FS","at "<<PRINT_IJK<<",l"<<l<<" nb1"<<nb1<<" nb2"<<nb2<<" dx"<<PRINT_VEC(dx,dy,dz)<<",srcl"<<debug_srcl<<" -> "<<newval );*/ \
|
||||
} /* l>2*dim free slip */ \
|
||||
\
|
||||
} /* type reflect */\
|
||||
|
@ -7,7 +7,15 @@
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __APPLE_CC__
|
||||
#include "solver_class.h"
|
||||
#endif // __APPLE_CC__
|
||||
|
||||
|
||||
#if !defined(__APPLE_CC__) || defined(LBM_FORCEINCLUDE)
|
||||
/******************************************************************************
|
||||
* helper functions
|
||||
*****************************************************************************/
|
||||
|
||||
//! for raytracing
|
||||
template<class D>
|
||||
@ -99,6 +107,36 @@ void LbmFsgrSolver<D>::prepareVisualization( void ) {
|
||||
*D::mpIso->lbmGetData( i+1 , j+1 ,ZKOFF+ZKD1) += ( val * mIsoWeight[26] );
|
||||
}
|
||||
|
||||
/*
|
||||
for(int k=0;k<mLevel[mMaxRefine].lSizez-1;k++)
|
||||
for(int j=0;j<mLevel[mMaxRefine].lSizey-1;j++) {
|
||||
*D::mpIso->lbmGetData(-1, j,ZKOFF) = *D::mpIso->lbmGetData( 1, j,ZKOFF);
|
||||
*D::mpIso->lbmGetData( 0, j,ZKOFF) = *D::mpIso->lbmGetData( 1, j,ZKOFF);
|
||||
*D::mpIso->lbmGetData( mLevel[mMaxRefine].lSizex-1, j,ZKOFF) = *D::mpIso->lbmGetData( mLevel[mMaxRefine].lSizex-2, j,ZKOFF);
|
||||
*D::mpIso->lbmGetData( mLevel[mMaxRefine].lSizex-0, j,ZKOFF) = *D::mpIso->lbmGetData( mLevel[mMaxRefine].lSizex-2, j,ZKOFF);
|
||||
}
|
||||
|
||||
for(int k=0;k<mLevel[mMaxRefine].lSizez-1;k++)
|
||||
for(int i=-1;i<mLevel[mMaxRefine].lSizex+1;i++) {
|
||||
*D::mpIso->lbmGetData( i,-1, ZKOFF) = *D::mpIso->lbmGetData( i, 1, ZKOFF);
|
||||
*D::mpIso->lbmGetData( i, 0, ZKOFF) = *D::mpIso->lbmGetData( i, 1, ZKOFF);
|
||||
*D::mpIso->lbmGetData( i, mLevel[mMaxRefine].lSizey-1, ZKOFF) = *D::mpIso->lbmGetData( i, mLevel[mMaxRefine].lSizey-2, ZKOFF);
|
||||
*D::mpIso->lbmGetData( i, mLevel[mMaxRefine].lSizey-0, ZKOFF) = *D::mpIso->lbmGetData( i, mLevel[mMaxRefine].lSizey-2, ZKOFF);
|
||||
}
|
||||
|
||||
if(D::cDimension == 3) {
|
||||
// only for 3D
|
||||
for(int j=-1;j<mLevel[mMaxRefine].lSizey+1;j++)
|
||||
for(int i=-1;i<mLevel[mMaxRefine].lSizex+1;i++) {
|
||||
//initEmptyCell(mMaxRefine, i,j,0, domainBoundType, 0.0, BND_FILL); initEmptyCell(mMaxRefine, i,j,mLevel[mMaxRefine].lSizez-1, domainBoundType, 0.0, BND_FILL);
|
||||
*D::mpIso->lbmGetData( i,j,-1 ) = *D::mpIso->lbmGetData( i,j,1 );
|
||||
*D::mpIso->lbmGetData( i,j, 0 ) = *D::mpIso->lbmGetData( i,j,1 );
|
||||
*D::mpIso->lbmGetData( i,j,mLevel[mMaxRefine].lSizez-1) = *D::mpIso->lbmGetData( i,j,mLevel[mMaxRefine].lSizez-2);
|
||||
*D::mpIso->lbmGetData( i,j,mLevel[mMaxRefine].lSizez-0) = *D::mpIso->lbmGetData( i,j,mLevel[mMaxRefine].lSizez-2);
|
||||
}
|
||||
}
|
||||
// */
|
||||
|
||||
// update preview, remove 2d?
|
||||
if(mOutputSurfacePreview) {
|
||||
//int previewSize = mOutputSurfacePreview;
|
||||
@ -139,31 +177,7 @@ void LbmFsgrSolver<D>::prepareVisualization( void ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* move the particles
|
||||
* uses updated velocities from mSetOther
|
||||
*****************************************************************************/
|
||||
template<class D>
|
||||
void LbmFsgrSolver<D>::advanceParticles(ParticleTracer *partt ) {
|
||||
partt = NULL; // remove warning
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* reset particle positions to default
|
||||
*****************************************************************************/
|
||||
/*! init particle positions */
|
||||
template<class D>
|
||||
int LbmFsgrSolver<D>::initParticles(ParticleTracer *partt) {
|
||||
partt = NULL; // remove warning
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*! init particle positions */
|
||||
/*! calculate speeds of fluid objects (or inflow) */
|
||||
template<class D>
|
||||
void LbmFsgrSolver<D>::recalculateObjectSpeeds() {
|
||||
int numobjs = (int)(D::mpGiObjects->size());
|
||||
@ -187,6 +201,137 @@ void LbmFsgrSolver<D>::recalculateObjectSpeeds() {
|
||||
mObjectPartslips[numobjs] = mDomainPartSlipValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/*! debug object display */
|
||||
/*****************************************************************************/
|
||||
template<class D>
|
||||
vector<ntlGeometryObject*> LbmFsgrSolver<D>::getDebugObjects() {
|
||||
vector<ntlGeometryObject*> debo;
|
||||
if(mOutputSurfacePreview) {
|
||||
debo.push_back( mpPreviewSurface );
|
||||
}
|
||||
#ifndef ELBEEM_BLENDER
|
||||
debo.push_back( mpTest );
|
||||
#endif // ELBEEM_BLENDER
|
||||
return debo;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* particle handling
|
||||
*****************************************************************************/
|
||||
|
||||
/*! init particle positions */
|
||||
template<class D>
|
||||
int LbmFsgrSolver<D>::initParticles(ParticleTracer *partt) {
|
||||
#ifdef ELBEEM_BLENDER
|
||||
partt = NULL; // remove warning
|
||||
#else // ELBEEM_BLENDER
|
||||
int workSet = mLevel[mMaxRefine].setCurr;
|
||||
int tries = 0;
|
||||
int num = 0;
|
||||
|
||||
//partt->setSimEnd ( ntlVec3Gfx(D::mSizex-1, D::mSizey-1, getForZMax1()) );
|
||||
partt->setSimEnd ( ntlVec3Gfx(D::mSizex, D::mSizey, D::getForZMaxBnd()) );
|
||||
partt->setSimStart( ntlVec3Gfx(0.0) );
|
||||
|
||||
while( (num<partt->getNumParticles()) && (tries<100*partt->getNumParticles()) ) {
|
||||
double x,y,z;
|
||||
x = 0.0+(( (float)(D::mSizex-1) ) * (rand()/(RAND_MAX+1.0)) );
|
||||
y = 0.0+(( (float)(D::mSizey-1) ) * (rand()/(RAND_MAX+1.0)) );
|
||||
z = 0.0+(( (float) D::getForZMax1() )* (rand()/(RAND_MAX+1.0)) );
|
||||
int i = (int)(x-0.5);
|
||||
int j = (int)(y-0.5);
|
||||
int k = (int)(z-0.5);
|
||||
if(D::cDimension==2) {
|
||||
k = 0;
|
||||
z = 0.5; // place in the middle of domain
|
||||
}
|
||||
|
||||
if( TESTFLAG( RFLAG(mMaxRefine, i,j,k, workSet), CFFluid ) ||
|
||||
TESTFLAG( RFLAG(mMaxRefine, i,j,k, workSet), CFFluid ) ) { // only fluid cells?
|
||||
// in fluid...
|
||||
partt->addParticle(x,y,z);
|
||||
num++;
|
||||
}
|
||||
tries++;
|
||||
}
|
||||
debMsgStd("LbmTestSolver::initParticles",DM_MSG,"Added "<<num<<" particles ", 10);
|
||||
if(num != partt->getNumParticles()) return 1;
|
||||
#endif // ELBEEM_BLENDER
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<class D>
|
||||
void LbmFsgrSolver<D>::advanceParticles(ParticleTracer *partt ) {
|
||||
#ifdef ELBEEM_BLENDER
|
||||
partt = NULL; // remove warning
|
||||
#else // ELBEEM_BLENDER
|
||||
int workSet = mLevel[mMaxRefine].setCurr;
|
||||
LbmFloat vx=0.0,vy=0.0,vz=0.0;
|
||||
LbmFloat rho, df[27]; //feq[27];
|
||||
|
||||
for(vector<ParticleObject>::iterator p= partt->getParticlesBegin();
|
||||
p!= partt->getParticlesEnd(); p++) {
|
||||
//errorOut(" p "<< (*p).getPos() );
|
||||
if( (*p).getActive()==false ) continue;
|
||||
int i,j,k;
|
||||
|
||||
// nearest neighbor, particle positions don't include empty bounds
|
||||
ntlVec3Gfx pos = (*p).getPos();
|
||||
i= (int)(pos[0]+0.5);
|
||||
j= (int)(pos[1]+0.5);
|
||||
k= (int)(pos[2]+0.5);
|
||||
if(D::cDimension==2) {
|
||||
k = 0;
|
||||
}
|
||||
|
||||
if( (i<0)||(i>D::mSizex-1)||
|
||||
(j<0)||(j>D::mSizey-1)||
|
||||
(k<0)||(k>D::mSizez-1) ) {
|
||||
(*p).setActive( false );
|
||||
continue;
|
||||
}
|
||||
|
||||
// no interpol
|
||||
rho = vx = vy = vz = 0.0;
|
||||
FORDF0{
|
||||
LbmFloat cdf = QCELL(mMaxRefine, i,j,k, workSet, l);
|
||||
df[l] = cdf;
|
||||
rho += cdf;
|
||||
vx += (D::dfDvecX[l]*cdf);
|
||||
vy += (D::dfDvecY[l]*cdf);
|
||||
vz += (D::dfDvecZ[l]*cdf);
|
||||
}
|
||||
|
||||
// remove gravity influence
|
||||
//FORDF0{ feq[l] = D::getCollideEq(l, rho,vx,vy,vz); }
|
||||
//const LbmFloat Qo = D::getLesNoneqTensorCoeff(df,feq);
|
||||
//const LbmFloat lesomega = D::getLesOmega(mLevel[mMaxRefine].omega,mLevel[mMaxRefine].lcsmago,Qo);
|
||||
const LbmFloat lesomega = mLevel[mMaxRefine].omega; // no les
|
||||
vx -= mLevel[mMaxRefine].gravity[0] * lesomega*0.5;
|
||||
vy -= mLevel[mMaxRefine].gravity[1] * lesomega*0.5;
|
||||
vz -= mLevel[mMaxRefine].gravity[2] * lesomega*0.5;
|
||||
|
||||
if( TESTFLAG( RFLAG(mMaxRefine, i,j,k, workSet), CFFluid ) ||
|
||||
TESTFLAG( RFLAG(mMaxRefine, i,j,k, workSet), CFInter ) ) {
|
||||
// still ok
|
||||
} else {
|
||||
// out of bounds, deactivate...
|
||||
// FIXME had fsgr treatment
|
||||
(*p).setActive( false );
|
||||
continue;
|
||||
D::mNumParticlesLost++;
|
||||
}
|
||||
|
||||
(*p).advance( vx,vy,vz );
|
||||
}
|
||||
#endif // ELBEEM_BLENDER
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/*! internal quick print function (for debugging) */
|
||||
/*****************************************************************************/
|
||||
@ -573,6 +718,10 @@ LbmFloat& LbmFsgrSolver<D>::debRAC(LbmFloat* s,int l) {
|
||||
#endif // FSGR_STRICT_DEBUG==1
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* GUI&debugging functions
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#if LBM_USE_GUI==1
|
||||
#define USE_GLUTILITIES
|
||||
@ -851,11 +1000,50 @@ void LbmFsgrSolver<D>::debugPrintNodeInfo(CellIdentifierInterface* cell, int for
|
||||
}
|
||||
}
|
||||
|
||||
#endif // !defined(__APPLE_CC__) || defined(LBM_FORCEINCLUDE)
|
||||
|
||||
/******************************************************************************
|
||||
* instantiation
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#ifndef __APPLE_CC__
|
||||
|
||||
#if LBMDIM==2
|
||||
template class LbmFsgrSolver< LbmBGK2D >;
|
||||
#define LBM_INSTANTIATE LbmBGK2D
|
||||
#endif // LBMDIM==2
|
||||
#if LBMDIM==3
|
||||
template class LbmFsgrSolver< LbmBGK3D >;
|
||||
#define LBM_INSTANTIATE LbmBGK3D
|
||||
#endif // LBMDIM==3
|
||||
|
||||
template class LbmFsgrSolver< LBM_INSTANTIATE >;
|
||||
|
||||
#endif // __APPLE_CC__
|
||||
|
||||
// the intel compiler is too smart - so the virtual functions called from other cpp
|
||||
// files have to be instantiated explcitly (otherwise this will cause undefined
|
||||
// references to "non virtual thunks") ... still not working, though
|
||||
//template<class LBM_INSTANTIATE> void LbmFsgrSolver<LBM_INSTANTIATE>::prepareVisualization( void );
|
||||
//template<class LBM_INSTANTIATE> vector<ntlGeometryObject*> LbmFsgrSolver<LBM_INSTANTIATE>::getDebugObjects();
|
||||
//template<class LBM_INSTANTIATE> int LbmFsgrSolver<LBM_INSTANTIATE>::initParticles(ParticleTracer *partt );
|
||||
//template<class LBM_INSTANTIATE> void LbmFsgrSolver<LBM_INSTANTIATE>::advanceParticles(ParticleTracer *partt );
|
||||
|
||||
// instantiate whole celliterator interface
|
||||
//template<class LBM_INSTANTIATE> CellIdentifierInterface* LbmFsgrSolver<LBM_INSTANTIATE>::getFirstCell( );
|
||||
//template<class LBM_INSTANTIATE> void LbmFsgrSolver<LBM_INSTANTIATE>::advanceCell( CellIdentifierInterface* );
|
||||
//template<class LBM_INSTANTIATE> bool LbmFsgrSolver<LBM_INSTANTIATE>::noEndCell( CellIdentifierInterface* );
|
||||
//template<class LBM_INSTANTIATE> void LbmFsgrSolver<LBM_INSTANTIATE>::deleteCellIterator( CellIdentifierInterface** );
|
||||
//template<class LBM_INSTANTIATE> CellIdentifierInterface* LbmFsgrSolver<LBM_INSTANTIATE>::getCellAt( ntlVec3Gfx pos );
|
||||
//template<class LBM_INSTANTIATE> int LbmFsgrSolver<LBM_INSTANTIATE>::getCellSet ( CellIdentifierInterface* );
|
||||
//template<class LBM_INSTANTIATE> ntlVec3Gfx LbmFsgrSolver<LBM_INSTANTIATE>::getCellOrigin ( CellIdentifierInterface* );
|
||||
//template<class LBM_INSTANTIATE> ntlVec3Gfx LbmFsgrSolver<LBM_INSTANTIATE>::getCellSize ( CellIdentifierInterface* );
|
||||
//template<class LBM_INSTANTIATE> int LbmFsgrSolver<LBM_INSTANTIATE>::getCellLevel ( CellIdentifierInterface* );
|
||||
//template<class LBM_INSTANTIATE> LbmFloat LbmFsgrSolver<LBM_INSTANTIATE>::getCellDensity ( CellIdentifierInterface* ,int set);
|
||||
//template<class LBM_INSTANTIATE> LbmVec LbmFsgrSolver<LBM_INSTANTIATE>::getCellVelocity ( CellIdentifierInterface* ,int set);
|
||||
//template<class LBM_INSTANTIATE> LbmFloat LbmFsgrSolver<LBM_INSTANTIATE>::getCellDf ( CellIdentifierInterface* ,int set, int dir);
|
||||
//template<class LBM_INSTANTIATE> LbmFloat LbmFsgrSolver<LBM_INSTANTIATE>::getCellMass ( CellIdentifierInterface* ,int set);
|
||||
//template<class LBM_INSTANTIATE> LbmFloat LbmFsgrSolver<LBM_INSTANTIATE>::getCellFill ( CellIdentifierInterface* ,int set);
|
||||
//template<class LBM_INSTANTIATE> CellFlagType LbmFsgrSolver<LBM_INSTANTIATE>::getCellFlag ( CellIdentifierInterface* ,int set);
|
||||
//template<class LBM_INSTANTIATE> LbmFloat LbmFsgrSolver<LBM_INSTANTIATE>::getEquilDf ( int );
|
||||
//template<class LBM_INSTANTIATE> int LbmFsgrSolver<LBM_INSTANTIATE>::getDfNum ( );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user