Hardened SimuData. Support writeGadget
This commit is contained in:
parent
adf14da4b4
commit
f4187185a7
2 changed files with 99 additions and 15 deletions
|
@ -64,6 +64,8 @@ namespace CosmoTool
|
|||
typedef void (*FreeFunction)(void *);
|
||||
typedef std::map<std::string, std::pair<void *, FreeFunction> > AttributeMap;
|
||||
|
||||
bool noAuto;
|
||||
|
||||
float BoxSize;
|
||||
float time;
|
||||
float Hubble;
|
||||
|
@ -81,21 +83,22 @@ namespace CosmoTool
|
|||
AttributeMap attributes;
|
||||
|
||||
public:
|
||||
SimuData() : Id(0),NumPart(0),type(0) { Pos[0]=Pos[1]=Pos[2]=0; Vel[0]=Vel[1]=Vel[2]=0; }
|
||||
SimuData() : Id(0),NumPart(0),type(0),noAuto(false) { Pos[0]=Pos[1]=Pos[2]=0; Vel[0]=Vel[1]=Vel[2]=0; }
|
||||
~SimuData()
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
if (Pos[j])
|
||||
delete[] Pos[j];
|
||||
if (Vel[j])
|
||||
delete[] Vel[j];
|
||||
}
|
||||
if (type)
|
||||
delete[] type;
|
||||
if (Id)
|
||||
delete[] Id;
|
||||
|
||||
if (!noAuto) {
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
if (Pos[j])
|
||||
delete[] Pos[j];
|
||||
if (Vel[j])
|
||||
delete[] Vel[j];
|
||||
}
|
||||
if (type)
|
||||
delete[] type;
|
||||
if (Id)
|
||||
delete[] Id;
|
||||
}
|
||||
for (AttributeMap::iterator i = attributes.begin();
|
||||
i != attributes.end();
|
||||
++i)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue