Structured the void center extraction

This commit is contained in:
Your Name 2011-02-17 11:52:16 -05:00
parent 5c9500628c
commit 36aa91c064
2 changed files with 23 additions and 3 deletions

View file

@ -9,11 +9,12 @@
using namespace std; using namespace std;
bool loadZobov(const char *descName, const char *adjName, const char *volName, ZobovRep& z) bool loadZobov(const char *descName, const char *adjName, const char *voidsName,
const char *volName, ZobovRep& z)
{ {
ifstream descFile(descName); ifstream descFile(descName);
ifstream adjFile(adjName); ifstream adjFile(adjName);
ifstream volFile(volName); ifstream volFile(voidsName);
int32_t numParticles, numZones, numPinZone; int32_t numParticles, numZones, numPinZone;
int32_t totalParticles; int32_t totalParticles;
int32_t numVoids; int32_t numVoids;
@ -77,6 +78,23 @@ bool loadZobov(const char *descName, const char *adjName, const char *volName, Z
delete[] zId; delete[] zId;
} }
if (volName != 0)
{
cout << "Loading particle volumes (requested)" << endl;
ifstream f(volName);
int numParticles;
if (!f)
{
cerr << "No such file " << volName << endl;
abort();
}
f.read((char *)&numParticles, sizeof(int));
z.particleVolume.resize(numParticles);
f.read((char *)&z.particleVolume[0], sizeof(float)*numParticles);
}
cout << "Loading description" << endl; cout << "Loading description" << endl;
string line; string line;

View file

@ -20,9 +20,11 @@ struct ZobovRep
{ {
std::vector<ZobovZone> allZones; std::vector<ZobovZone> allZones;
std::vector<ZobovVoid> allVoids; std::vector<ZobovVoid> allVoids;
std::vector<float> particleVolume;
}; };
bool loadZobov(const char *descName, bool loadZobov(const char *descName,
const char *adjName, const char *volName, ZobovRep& z); const char *adjName, const char *voidName,
const char *volName, ZobovRep& z);
#endif #endif