#include <ParticleState.h>
Public Member Functions | |
int | GeneratePGroups (int pgroups_requested) |
ParticleGroup & | GetPGroup (int p_group_num) |
int | GenerateALists (int alists_requested) |
ActionList & | GetAList (int a_list_num) |
ParticleState () | |
~ParticleState () | |
void | SendAction (PActionBase *S) |
void | ExecuteActionList (ActionList &AList) |
void | SetError (const int err, const std::string &str) |
Public Attributes | |
pDomain * | Up |
pDomain * | Vel |
pDomain * | RotVel |
pDomain * | VertexB |
pDomain * | Size |
pDomain * | Color |
pDomain * | Alpha |
float | Age |
float | AgeSigma |
float | Mass |
float | dt |
bool | in_call_list |
bool | in_new_list |
bool | vertexB_tracks |
int | tid |
int | ErrorCode |
int | pgroup_id |
int | alist_id |
Static Public Attributes | |
static std::vector< ParticleGroup > | PGroups |
static std::vector< ActionList > | ALists |
Definition at line 22 of file ParticleState.h.
ParticleState::ParticleState | ( | ) |
Definition at line 34 of file ParticleState.cpp.
References Age, AgeSigma, alist_id, dt, ErrorCode, in_call_list, in_new_list, Mass, PERR_NO_ERROR, pgroup_id, tid, and vertexB_tracks.
00034 : Up(new PDPoint(P010)), Vel(new PDPoint(P000)), RotVel(new PDPoint(P000)), 00035 VertexB(new PDPoint(P000)), Size(new PDPoint(P111)), Color(new PDPoint(P111)), Alpha(new PDPoint(P111)) 00036 { 00037 in_call_list = false; 00038 in_new_list = false; 00039 vertexB_tracks = true; 00040 00041 dt = 1.0f; 00042 00043 pgroup_id = -1; 00044 alist_id = -1; 00045 tid = 0; // This must be filled in if we're multi-threaded. 00046 ErrorCode = PERR_NO_ERROR; 00047 00048 Age = 0.0f; 00049 AgeSigma = 0.0f; 00050 Mass = 1.0f; 00051 }
ParticleState::~ParticleState | ( | ) |
int ParticleState::GeneratePGroups | ( | int | pgroups_requested | ) |
Definition at line 106 of file ParticleState.cpp.
References PGroups.
Referenced by pGenParticleGroups().
00107 { 00108 int old_size = (int)PGroups.size(); 00109 PGroups.resize(old_size + pgroups_requested); 00110 00111 return old_size; 00112 }
ParticleGroup & ParticleState::GetPGroup | ( | int | p_group_num | ) |
Definition at line 74 of file ParticleState.cpp.
References PGroups.
Referenced by ExecuteActionList(), pBirthCallback(), pCopyGroup(), pDeathCallback(), pGetGroupCount(), pReset(), pSetMaxParticles(), pVertex(), and SendAction().
00075 { 00076 if(p_group_num < 0) { 00077 std::cerr << "ERROR: Negative particle group number\n"; 00078 abort(); // IERROR 00079 } 00080 00081 if(p_group_num >= (int)PGroups.size()) { 00082 std::cerr << "ERROR: Bad particle group number\n"; 00083 abort(); // IERROR 00084 } 00085 00086 return PGroups[p_group_num]; 00087 }
int ParticleState::GenerateALists | ( | int | alists_requested | ) |
Definition at line 116 of file ParticleState.cpp.
References ALists.
Referenced by pGenActionLists().
00117 { 00118 int old_size = (int)ALists.size(); 00119 ALists.resize(old_size + alists_requested); 00120 00121 return old_size; 00122 }
ActionList & ParticleState::GetAList | ( | int | a_list_num | ) |
Definition at line 89 of file ParticleState.cpp.
References ALists.
Referenced by SendAction().
00090 { 00091 if(a_list_num < 0) { 00092 std::cerr << "ERROR: Negative action list number\n"; 00093 abort(); // IERROR 00094 } 00095 00096 if(a_list_num >= (int)ALists.size()) { 00097 std::cerr << "ERROR: Bad action list number\n"; 00098 abort(); // IERROR 00099 } 00100 00101 return ALists[a_list_num]; 00102 }
void ParticleState::SendAction | ( | PActionBase * | S | ) |
Definition at line 125 of file ParticleState.cpp.
References alist_id, ParticleGroup::begin(), dt, PActionBase::dt, ParticleGroup::end(), GetAList(), GetPGroup(), in_new_list, and pgroup_id.
Referenced by pAvoid(), pBounce(), pCallActionList(), pCopyVertexB(), pDamping(), pExplosion(), pFollow(), pFountain(), pGravitate(), pGravity(), pJet(), pKillOld(), pMatchRotVelocity(), pMatchVelocity(), pMove(), pOrbitLine(), pOrbitPoint(), pRandomAccel(), pRandomDisplace(), pRandomRotVelocity(), pRandomVelocity(), pRestore(), pRotDamping(), pSink(), pSinkVelocity(), pSort(), pSource(), pSpeedLimit(), pTargetColor(), pTargetRotVelocity(), pTargetSize(), pTargetVelocity(), and pVortex().
00126 { 00127 if(in_new_list) { 00128 // Add action S to the end of the current action list. 00129 ActionList &AList = GetAList(alist_id); 00130 AList.push_back(S); 00131 } else { 00132 // Immediate mode. Execute it. 00133 S->dt = dt; // This is a hack to provide local access to dt. 00134 ParticleGroup &pg = GetPGroup(pgroup_id); 00135 S->Execute(pg, pg.begin(), pg.end()); 00136 delete S; 00137 } 00138 }
void ParticleState::ExecuteActionList | ( | ActionList & | AList | ) |
Definition at line 141 of file ParticleState.cpp.
References ParticleGroup::begin(), dt, ParticleGroup::end(), GetPGroup(), in_call_list, pgroup_id, and PWorkingSetSize.
Referenced by pCallActionList().
00142 { 00143 ParticleGroup &pg = GetPGroup(pgroup_id); 00144 in_call_list = true; 00145 00146 ActionList::iterator it = AList.begin(); 00147 while(it != AList.end()) { 00148 // Make an action segment 00149 ActionList::iterator abeg = it; 00150 ActionList::iterator aend = it+1; 00151 00152 // If the first one is connectable, try to connect some more. 00153 if(!(*abeg)->GetKillsParticles() && !(*abeg)->GetDoNotSegment()) 00154 while(aend != AList.end() && !(*aend)->GetKillsParticles() && !(*aend)->GetDoNotSegment()) 00155 aend++; 00156 00157 // Found a sub-list that can be done together. Now do them. 00158 ParticleList::iterator pbeg = pg.begin(); 00159 ParticleList::iterator pend = min(pbeg + PWorkingSetSize, pg.end()); 00160 bool one_pass = false; 00161 if(aend - abeg == 1) { 00162 pend = pg.end(); // If a single action, do the whole thing in one whack. 00163 one_pass = true; 00164 } 00165 00166 ActionList::iterator ait = abeg; 00167 do { 00168 // For each chunk of particles, do all the actions in this sub-list 00169 ait = abeg; 00170 while(ait < aend) { 00171 (*ait)->dt = dt; // This is a hack to provide local access to dt. 00172 (*ait)->Execute(pg, pbeg, pend); 00173 00174 // This is a hack to handle our compound object experiment. 00175 if(typeid(ait) == typeid(PAFountain)) 00176 ait += 6; 00177 else 00178 ait++; 00179 } 00180 pbeg = pend; 00181 pend = min(pend + PWorkingSetSize, pg.end()); 00182 } while (!one_pass && pbeg != pg.end()); 00183 it = ait; 00184 } 00185 in_call_list = false; 00186 }
void ParticleState::SetError | ( | const int | err, | |
const std::string & | str | |||
) |
Definition at line 64 of file ParticleState.cpp.
References ErrorCode, and PERR_NO_ERROR.
00065 { 00066 std::cerr << Str << std::endl; 00067 00068 if(ErrorCode == PERR_NO_ERROR) // Keep the first error. 00069 ErrorCode = err; 00070 00071 abort(); 00072 }
Definition at line 25 of file ParticleState.h.
Referenced by pSource(), pUpVec(), pUpVecD(), pVertex(), and ~ParticleState().
Definition at line 26 of file ParticleState.h.
Referenced by pSource(), pVelocity(), pVelocityD(), pVertex(), and ~ParticleState().
Definition at line 27 of file ParticleState.h.
Referenced by pRotVelocity(), pRotVelocityD(), pSource(), pVertex(), and ~ParticleState().
Definition at line 28 of file ParticleState.h.
Referenced by pSource(), pVertex(), pVertexB(), pVertexBD(), and ~ParticleState().
Definition at line 29 of file ParticleState.h.
Referenced by pSize(), pSizeD(), pSource(), pVertex(), and ~ParticleState().
Definition at line 30 of file ParticleState.h.
Referenced by pColor(), pColorD(), pSource(), pVertex(), and ~ParticleState().
Definition at line 31 of file ParticleState.h.
Referenced by pColor(), pColorD(), pSource(), pVertex(), and ~ParticleState().
float ParticleState::Age |
Definition at line 32 of file ParticleState.h.
Referenced by ParticleState(), pSource(), pStartingAge(), and pVertex().
float ParticleState::AgeSigma |
Definition at line 33 of file ParticleState.h.
Referenced by ParticleState(), pSource(), and pStartingAge().
float ParticleState::Mass |
Definition at line 34 of file ParticleState.h.
Referenced by ParticleState(), pMass(), and pVertex().
float ParticleState::dt |
Definition at line 36 of file ParticleState.h.
Referenced by ExecuteActionList(), ParticleState(), pTimeStep(), and SendAction().
Definition at line 37 of file ParticleState.h.
Referenced by ExecuteActionList(), and ParticleState().
Definition at line 38 of file ParticleState.h.
Referenced by ParticleState(), pBirthCallback(), pCallActionList(), pCopyGroup(), pCurrentGroup(), pDeathCallback(), pDeleteActionLists(), pEndActionList(), pGenActionLists(), pGenParticleGroups(), pGetGroupCount(), pGetMaxParticles(), pGetParticlePointer(), pGetParticles(), pNewActionList(), pReset(), pSetMaxParticles(), pVertex(), and SendAction().
Definition at line 39 of file ParticleState.h.
Referenced by ParticleState(), pSource(), pVertex(), and pVertexBTracks().
std::vector< ParticleGroup > ParticleState::PGroups [static] |
Definition at line 43 of file ParticleState.h.
Referenced by GeneratePGroups(), GetPGroup(), pCopyGroup(), pCurrentGroup(), pDeleteParticleGroups(), pGenParticleGroups(), pGetGroupCount(), pGetMaxParticles(), pGetParticlePointer(), and pGetParticles().
Definition at line 44 of file ParticleState.h.
Referenced by ExecuteActionList(), ParticleState(), pBirthCallback(), pCopyGroup(), pCurrentGroup(), pDeathCallback(), pGetGroupCount(), pGetMaxParticles(), pGetParticlePointer(), pGetParticles(), pReset(), pSetMaxParticles(), pVertex(), and SendAction().
std::vector< ActionList > ParticleState::ALists [static] |
Definition at line 48 of file ParticleState.h.
Referenced by GenerateALists(), GetAList(), pCallActionList(), pDeleteActionLists(), pDeleteParticleGroups(), and pNewActionList().
Definition at line 49 of file ParticleState.h.
Referenced by ParticleState(), pEndActionList(), pNewActionList(), and SendAction().