| 175 | } |
| 176 | |
| 177 | size_t NParticleReader::numParticles() |
| 178 | { |
| 179 | if( !open() ) |
| 180 | { |
| 181 | return 0; |
| 182 | } |
| 183 | |
| 184 | int numParticles = 0; |
| 185 | int frameIndex = m_frameParameter->getNumericValue(); |
| 186 | int frame = m_frames->readable()[frameIndex]; |
| 187 | std::map<int, IFFFile::Chunk::ChunkIterator>::const_iterator frameIt = frameToRootChildren.find( frame ); |
| 188 | if( frameIt == frameToRootChildren.end() ) |
| 189 | { |
| 190 | msg( Msg::Warning, "NParticleReader::attributeNames()", boost::format( "Frame '%d' (index '%d') does not exist in '%s'." ) % frame % frameIndex % m_iffFileName ); |
| 191 | return 0; |
| 192 | } |
| 193 | |
| 194 | IFFFile::Chunk::ChunkIterator child = frameIt->second; |
| 195 | IFFFile::Chunk::ChunkIterator it = child->childrenBegin(); |
| 196 | |
| 197 | for ( ; it != child->childrenEnd(); it++ ) |
| 198 | { |
| 199 | if ( it->type().id() == kSIZE ) |
| 200 | { |
| 201 | it->read( numParticles ); |
| 202 | break; |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | return numParticles; |
| 207 | } |
| 208 | |
| 209 | void NParticleReader::attributeNames( std::vector<std::string> &names ) |
| 210 | { |
no test coverage detected