Blender V2.61 - r43446
Defines | Typedefs | Functions | Variables

utilities.h File Reference

#include "ntl_vector3dim.h"

Go to the source code of this file.

Defines

#define DEBUG   10
#define SIMWORLD_INVALID   0
#define SIMWORLD_INITIALIZING   1
#define SIMWORLD_INITED   2
#define SIMWORLD_STOP   3
#define SIMWORLD_INITERROR   -1
#define SIMWORLD_PANIC   -2
#define SIMWORLD_GENERICERROR   -3
#define DM_MSG   1
#define DM_NOTIFY   2
#define DM_IMPORTANT   3
#define DM_WARNING   4
#define DM_ERROR   5
#define DM_DIRECT   6
#define DM_FATAL   7
#define MSGSTREAM   std::ostringstream msg; msg.precision(7); msg.width(9);
#define debMsgDirect(mStr)   if(gDebugLevel>0) { std::ostringstream msg; msg << mStr; messageOutputFunc(string(""), DM_DIRECT, msg.str(), 0); }
#define debMsgStd(from, id, mStr, level)   if(gDebugLevel>=level) { MSGSTREAM; msg << mStr <<"\n"; messageOutputFunc(from, id, msg.str(), 0); }
#define debMsgNnl(from, id, mStr, level)   if(gDebugLevel>=level) { MSGSTREAM; msg << mStr ; messageOutputFunc(from, id, msg.str(), 0); }
#define debMsgInter(from, id, mStr, level, interval)   if(gDebugLevel>=level) { MSGSTREAM; msg << mStr <<"\n"; messageOutputFunc(from, id, msg.str(), interval); }
#define debugOut(mStr, level)   if(gDebugLevel>=level) { debMsgStd("D",DM_MSG,mStr,level); }
#define debugOutNnl(mStr, level)   if(gDebugLevel>=level) { debMsgNnl("D",DM_MSG,mStr,level); }
#define debugOutInter(mStr, level, interval)   debMsgInter("D",DM_MSG ,mStr,level, interval);
#define errMsg(from, mStr)   if(gDebugLevel>0){ MSGSTREAM; msg << mStr <<"\n"; messageOutputFunc(from, DM_ERROR, msg.str(), 0); }
#define warnMsg(from, mStr)   if(gDebugLevel>0){ MSGSTREAM; msg << mStr <<"\n"; messageOutputFunc(from, DM_WARNING, msg.str(), 0); }
#define errorOut(mStr)   { errMsg("D",mStr); }
#define errFatal(from, mStr, errCode)
#define PRINT_VEC(x, y, z)   " ["<<(x)<<","<<(y)<<","<<(z)<<"] "
#define PRINT_VEC2D(x, y)   " ["<<(x)<<","<<(y)<<"] "
#define PRINT_IJK_NBL   PRINT_VEC(i+D::dfVecX[l],j+D::dfVecY[l],k+D::dfVecZ[l])
#define PRINT_IJK   PRINT_VEC(i,j,k)
#define PRINT_IJ   PRINT_VEC2D(i,j)
#define PRINT_NTLVEC(v)   " ["<<(v)[0]<<","<<(v)[1]<<","<<(v)[2]<<"] "
#define PRINT_NTLVEC2D(v)   " ["<<(v)[0]<<","<<(v)[1]<<"] "
#define PRINT_TRIANGLE(t, mpV)
#define UTILITIES_H

Typedefs

typedef unsigned long myTime_t

Functions

void setElbeemState (int set)
int getElbeemState (void)
int isSimworldOk (void)
void setElbeemErrorString (const char *set)
char * getElbeemErrorString (void)
void messageOutputFunc (string from, int id, string msg, myTime_t interval)
int convertString2Int (const char *str, int alt)
 helper function that converts a string to integer
string convertFlags2String (int flags)
 helper function that converts a flag field to a readable integer
myTime_t getTime ()
 get the current system time
string getTimeString (myTime_t usecs)
 convert time to readable string
bool checkBoundingBox (ntlVec3Gfx s, ntlVec3Gfx e, string checker)
 helper to check if a bounding box was specified in the right way
void resetGlobalColorSetting ()
 reset color output for elbeem init
int writePng (const char *fileName, unsigned char **rowsp, int w, int h)
 write png image
template<class T >
MIN (T a, T b)
template<class T >
MAX (T a, T b)
template<class T >
ABS (T a)
template<class T >
SIGNUM (T a)
template<class T >
SIGNUM0 (T a)
int ROUND (double d)
template<class T >
SQUARE (T a)

Variables

int gDebugLevel

Detailed Description

Definition in file utilities.h.


Define Documentation

#define debMsgDirect (   mStr)    if(gDebugLevel>0) { std::ostringstream msg; msg << mStr; messageOutputFunc(string(""), DM_DIRECT, msg.str(), 0); }

Definition at line 76 of file utilities.h.

Referenced by LbmFsgrSolver::adaptTimestep(), and LbmFsgrSolver::stepMain().

#define debMsgInter (   from,
  id,
  mStr,
  level,
  interval 
)    if(gDebugLevel>=level) { MSGSTREAM; msg << mStr <<"\n"; messageOutputFunc(from, id, msg.str(), interval); }

Definition at line 79 of file utilities.h.

#define debMsgNnl (   from,
  id,
  mStr,
  level 
)    if(gDebugLevel>=level) { MSGSTREAM; msg << mStr ; messageOutputFunc(from, id, msg.str(), 0); }

Definition at line 78 of file utilities.h.

#define debMsgStd (   from,
  id,
  mStr,
  level 
)    if(gDebugLevel>=level) { MSGSTREAM; msg << mStr <<"\n"; messageOutputFunc(from, id, msg.str(), 0); }

Definition at line 77 of file utilities.h.

Referenced by LbmFsgrSolver::adaptTimestep(), LbmFsgrSolver::advanceParticles(), ntlWorld::advanceSims(), ntlScene::buildScene(), Parametrizer::calculateAddForce(), Parametrizer::calculateAllMissingValues(), ControlParticles::calculateKernelWeight(), calculateMemreqEstimate(), MeanValueMeshCoords::calculateMVMCs(), SimulationObject::checkCallerStatus(), ParticleTracer::checkDumpTextPositions(), LbmFsgrSolver::coarseAdvance(), LbmFsgrSolver::coarseCalculateFluxareas(), SimulationObject::copyElbeemSettings(), LbmFsgrSolver::debugPrintNodeInfo(), elbeemAddMesh(), elbeemCheckDebugEnv(), elbeemContinueSimulation(), elbeemInit(), elbeemSimulate(), LbmFsgrSolver::fineAdvance(), ntlWorld::finishWorldInit(), ParticleTracer::getTriangles(), LbmFsgrSolver::handleCpdata(), if(), ntlGeometryObject::initChannels(), LbmFsgrSolver::initCpdata(), LbmFsgrSolver::initFreeSurfaces(), ControlParticles::initFromMVCMesh(), LbmFsgrSolver::initGeometryFlags(), LbmSolverInterface::initGeoTree(), initGridSizes(), ntlGeometryObject::initialize(), ntlGeometryObjModel::initialize(), IsoSurface::initializeIsosurface(), SimulationObject::initializeLbmSimulation(), LbmFsgrSolver::initializeSolverGrids(), LbmFsgrSolver::initializeSolverMemory(), LbmFsgrSolver::initializeSolverPostinit(), LbmFsgrSolver::initLevelOmegas(), ntlGeometryObjModel::initModel(), LbmFsgrSolver::initMovingObstacles(), ntlGeometryObject::initMovingPoints(), ntlGeometryObject::initMovingPointsAnim(), LbmFsgrSolver::initParticles(), LbmFsgrSolver::initStandingFluidGradient(), LbmSolverInterface::LbmSolverInterface(), ntlGeometryObjModel::loadBobjModel(), ParticleTracer::notifyOfDump(), ntlGeometryObject::notifyOfDump(), ntlTree::ntlTree(), LbmFsgrSolver::parseAttrList(), LbmControlData::parseControldataAttrList(), LbmSolverInterface::parseStdAttrList(), ParticleTracer::ParticleTracer(), ControlParticles::prepareControl(), ntlWorld::renderAnimation(), ntlWorld::renderScene(), ntlBlenderDumper::renderScene(), ntlWorld::renderVisualization(), LbmFsgrSolver::stepMain(), IsoSurface::triangulate(), LbmFsgrSolver::~LbmFsgrSolver(), ntlBlenderDumper::~ntlBlenderDumper(), ntlWorld::~ntlWorld(), ParticleTracer::~ParticleTracer(), and SimulationObject::~SimulationObject().

#define DEBUG   10

Definition at line 23 of file utilities.h.

#define debugOut (   mStr,
  level 
)    if(gDebugLevel>=level) { debMsgStd("D",DM_MSG,mStr,level); }
#define debugOutInter (   mStr,
  level,
  interval 
)    debMsgInter("D",DM_MSG ,mStr,level, interval);

Definition at line 82 of file utilities.h.

Referenced by ntlTree::ntlTree(), ntlWorld::renderScene(), and ntlTree::subdivide().

#define debugOutNnl (   mStr,
  level 
)    if(gDebugLevel>=level) { debMsgNnl("D",DM_MSG,mStr,level); }

Definition at line 81 of file utilities.h.

Referenced by SimulationObject::initializeLbmSimulation().

#define DM_DIRECT   6

Definition at line 64 of file utilities.h.

Referenced by messageOutputFunc().

#define DM_ERROR   5

Definition at line 63 of file utilities.h.

Referenced by messageOutputFunc().

#define DM_FATAL   7

Definition at line 65 of file utilities.h.

Referenced by messageOutputFunc().

#define DM_IMPORTANT   3

Definition at line 61 of file utilities.h.

Referenced by Parametrizer::calculateAllMissingValues(), and messageOutputFunc().

#define DM_MSG   1

Definition at line 59 of file utilities.h.

Referenced by LbmFsgrSolver::adaptTimestep(), LbmFsgrSolver::advanceParticles(), ntlWorld::advanceSims(), ntlScene::buildScene(), Parametrizer::calculateAddForce(), Parametrizer::calculateAllMissingValues(), ControlParticles::calculateKernelWeight(), calculateMemreqEstimate(), MeanValueMeshCoords::calculateMVMCs(), ParticleTracer::checkDumpTextPositions(), LbmFsgrSolver::coarseCalculateFluxareas(), SimulationObject::copyElbeemSettings(), LbmFsgrSolver::debugPrintNodeInfo(), elbeemAddMesh(), elbeemDebugOut(), ntlWorld::finishWorldInit(), ParticleTracer::getTriangles(), LbmFsgrSolver::handleCpdata(), if(), ntlGeometryObject::initChannels(), LbmFsgrSolver::initCpdata(), LbmFsgrSolver::initFreeSurfaces(), ControlParticles::initFromMVCMesh(), LbmFsgrSolver::initGeometryFlags(), LbmSolverInterface::initGeoTree(), initGridSizes(), ntlGeometryObject::initialize(), IsoSurface::initializeIsosurface(), SimulationObject::initializeLbmSimulation(), LbmFsgrSolver::initializeSolverGrids(), LbmFsgrSolver::initializeSolverMemory(), LbmFsgrSolver::initializeSolverPostinit(), LbmFsgrSolver::initLevelOmegas(), ntlGeometryObjModel::initModel(), LbmFsgrSolver::initMovingObstacles(), ntlGeometryObject::initMovingPoints(), ntlGeometryObject::initMovingPointsAnim(), LbmFsgrSolver::initParticles(), LbmFsgrSolver::initStandingFluidGradient(), LbmSolverInterface::LbmSolverInterface(), ntlGeometryObjModel::loadBobjModel(), messageOutputFunc(), ParticleTracer::notifyOfDump(), ntlGeometryObject::notifyOfDump(), ntlTree::ntlTree(), ParticleTracer::ParticleTracer(), ControlParticles::prepareControl(), ntlWorld::renderScene(), ntlBlenderDumper::renderScene(), ntlWorld::renderVisualization(), LbmFsgrSolver::stepMain(), IsoSurface::triangulate(), LbmFsgrSolver::~LbmFsgrSolver(), ParticleTracer::~ParticleTracer(), and SimulationObject::~SimulationObject().

#define DM_NOTIFY   2
#define DM_WARNING   4
#define errFatal (   from,
  mStr,
  errCode 
)
#define errMsg (   from,
  mStr 
)    if(gDebugLevel>0){ MSGSTREAM; msg << mStr <<"\n"; messageOutputFunc(from, DM_ERROR, msg.str(), 0); }

Definition at line 84 of file utilities.h.

Referenced by LbmFsgrSolver::adaptGrid(), LbmFsgrSolver::adaptTimestep(), LbmFsgrSolver::advanceParticles(), ntlWorld::advanceSims(), ntlGeometryObject::applyTransformation(), ntlGeometryObjModel::calcTriangleDivs(), Parametrizer::calculateAllMissingValues(), Parametrizer::calculateGravity(), ControlParticles::calculateKernelWeight(), Parametrizer::calculateLatticeViscosity(), Parametrizer::calculateOmega(), SimulationObject::checkCallerStatus(), ControlParticles::checkPointInside(), LbmFsgrSolver::checkSymmetry(), ParticleTracer::cleanup(), LbmFsgrSolver::coarseAdvance(), LbmFsgrSolver::coarseRestrictCell(), LbmFsgrSolver::coarseRestrictFromFine(), MeanValueMeshCoords::computeWeights(), elbeemContinueSimulation(), elbeemSimplifyChannelFloat(), elbeemSimplifyChannelVec3(), LbmFsgrSolver::fineAdvance(), LbmSolverInterface::geoInitCheckPointInside(), Parametrizer::getAniFrameTime(), IsoSurface::getData(), LbmSolverInterface::getGeoMaxMovementVelocity(), ParticleTracer::getTriangles(), LbmFsgrSolver::handleCpdata(), Parametrizer::initAniFrameTimeChannel(), LbmFsgrSolver::initCpdata(), ControlParticles::initFromMVCMesh(), ControlParticles::initFromObject(), Parametrizer::initGravityChannel(), ntlGeometryObjModel::initialize(), SimulationObject::initializeLbmSimulation(), LbmFsgrSolver::initializeSolverGrids(), LbmFsgrSolver::initializeSolverMemory(), LbmFsgrSolver::initLevelOmegas(), ntlGeometryObjModel::initModel(), LbmFsgrSolver::initMovingObstacles(), ntlGeometryObject::initMovingPoints(), ntlGeometryObject::initMovingPointsAnim(), LbmFsgrSolver::initParticles(), LbmFsgrSolver::initStandingFluidGradient(), Parametrizer::initViscosityChannel(), LbmFsgrSolver::interpolateCellValues(), LbmFsgrSolver::LbmFsgrSolver(), IsoSurface::lbmGetData(), ntlGeometryObjModel::loadBobjModel(), LbmFsgrSolver::mainLoop(), ControlParticles::mirrorTime(), ParticleTracer::notifyOfDump(), ntlTree::ntlTree(), LbmFsgrSolver::parseAttrList(), Parametrizer::parseAttrList(), LbmControlData::parseControldataAttrList(), LbmSolverInterface::parseStdAttrList(), LbmSolverInterface::readBoundaryFlagInt(), LbmFsgrSolver::recalculateObjectSpeeds(), LbmFsgrSolver::reinitFlags(), ntlWorld::renderScene(), ntlBlenderDumper::renderScene(), Parametrizer::setAniFrameTimeChannel(), Parametrizer::setFrameNum(), Parametrizer::setGravity(), Parametrizer::setViscosity(), ntlWorld::singleStepSims(), LbmFsgrSolver::stepMain(), MeanValueMeshCoords::transfer(), IsoSurface::triangulate(), writePng(), ntlGeometryObjModel::~ntlGeometryObjModel(), and ntlScene::~ntlScene().

#define errorOut (   mStr)    { errMsg("D",mStr); }
#define MSGSTREAM   std::ostringstream msg; msg.precision(7); msg.width(9);

Definition at line 73 of file utilities.h.

#define PRINT_IJ   PRINT_VEC2D(i,j)

print i,j,k as a vector, as we need ijk all the time

Definition at line 141 of file utilities.h.

#define PRINT_IJK   PRINT_VEC(i,j,k)
#define PRINT_IJK_NBL   PRINT_VEC(i+D::dfVecX[l],j+D::dfVecY[l],k+D::dfVecZ[l])

print l'th neighbor of i,j,k as a vector, as we need ijk all the time

Definition at line 135 of file utilities.h.

#define PRINT_NTLVEC (   v)    " ["<<(v)[0]<<","<<(v)[1]<<","<<(v)[2]<<"] "

print some vector from 3 values e.g. for ux,uy,uz

Definition at line 144 of file utilities.h.

Referenced by Parametrizer::calculateAllMissingValues().

#define PRINT_NTLVEC2D (   v)    " ["<<(v)[0]<<","<<(v)[1]<<"] "

print some vector from 3 values e.g. for ux,uy,uz

Definition at line 147 of file utilities.h.

#define PRINT_TRIANGLE (   t,
  mpV 
)
Value:
" { "<<PRINT_VEC( (mpV[(t).getPoints()[0]][0]),(mpV[(t).getPoints()[0]][1]),(mpV[(t).getPoints()[0]][2]) )<<\
    PRINT_VEC( (mpV[(t).getPoints()[1]][0]),(mpV[(t).getPoints()[1]][1]),(mpV[(t).getPoints()[1]][2]) )<<" | "<<\
    PRINT_VEC( (mpV[(t).getPoints()[2]][0]),(mpV[(t).getPoints()[2]][1]),(mpV[(t).getPoints()[2]][2]) )<<" } "

print a triangle

Definition at line 150 of file utilities.h.

#define PRINT_VEC (   x,
  y,
 
)    " ["<<(x)<<","<<(y)<<","<<(z)<<"] "
#define PRINT_VEC2D (   x,
 
)    " ["<<(x)<<","<<(y)<<"] "

print some vector from 3 values e.g. for ux,uy,uz

Definition at line 132 of file utilities.h.

#define SIMWORLD_GENERICERROR   -3
#define SIMWORLD_INITED   2
#define SIMWORLD_INITERROR   -1
#define SIMWORLD_INITIALIZING   1

Definition at line 36 of file utilities.h.

Referenced by elbeemAddDomain(), elbeemAddMesh(), and elbeemInit().

#define SIMWORLD_INVALID   0

Definition at line 34 of file utilities.h.

Referenced by elbeemAddDomain().

#define SIMWORLD_PANIC   -2

Definition at line 44 of file utilities.h.

Referenced by LbmFsgrSolver::getCollideEq().

#define SIMWORLD_STOP   3
#define UTILITIES_H

Definition at line 210 of file utilities.h.

#define warnMsg (   from,
  mStr 
)    if(gDebugLevel>0){ MSGSTREAM; msg << mStr <<"\n"; messageOutputFunc(from, DM_WARNING, msg.str(), 0); }

Typedef Documentation

typedef unsigned long myTime_t

Definition at line 29 of file utilities.h.


Function Documentation

template<class T >
T ABS ( a) [inline]

Definition at line 183 of file utilities.h.

bool checkBoundingBox ( ntlVec3Gfx  s,
ntlVec3Gfx  e,
string  checker 
)

helper to check if a bounding box was specified in the right way

string convertFlags2String ( int  flags)

helper function that converts a flag field to a readable integer

Definition at line 114 of file utilities.cpp.

References i, and max.

Referenced by LbmFsgrSolver::debugPrintNodeInfo(), and initGridSizes().

int convertString2Int ( const char *  str,
int  alt 
)

helper function that converts a string to integer

Definition at line 96 of file utilities.cpp.

References simple_enum_gen::val.

char* getElbeemErrorString ( void  )

Definition at line 64 of file utilities.cpp.

References gElbeemErrorString.

Referenced by elbeemGetErrorString().

int getElbeemState ( void  )
myTime_t getTime ( )
string getTimeString ( myTime_t  usecs)
int isSimworldOk ( void  )
template<class T >
T MAX ( a,
b 
) [inline]

Definition at line 177 of file utilities.h.

void messageOutputFunc ( string  from,
int  id,
string  msg,
myTime_t  interval 
)
template<class T >
T MIN ( a,
b 
) [inline]

Definition at line 168 of file utilities.h.

void resetGlobalColorSetting ( )

reset color output for elbeem init

Definition at line 79 of file utilities.cpp.

References DEF_globalColorSetting, and globalColorSetting.

Referenced by elbeemInit().

int ROUND ( double  d) [inline]

Definition at line 200 of file utilities.h.

void setElbeemErrorString ( const char *  set)

Definition at line 61 of file utilities.cpp.

References gElbeemErrorString.

Referenced by elbeemInit().

void setElbeemState ( int  set)
template<class T >
T SIGNUM ( a) [inline]

Definition at line 189 of file utilities.h.

template<class T >
T SIGNUM0 ( a) [inline]

Definition at line 195 of file utilities.h.

template<class T >
T SQUARE ( a) [inline]

Definition at line 206 of file utilities.h.

int writePng ( const char *  fileName,
unsigned char **  rowsp,
int  w,
int  h 
)

write png image

Definition at line 134 of file utilities.cpp.

References errMsg, and NULL.

Referenced by ntlWorld::renderScene().


Variable Documentation

Definition at line 25 of file utilities.h.