Filter uniqueID attribute

This commit is contained in:
Guilhem Lavaux 2014-11-20 10:57:17 +01:00
parent 15e065a833
commit 5f332edf02
2 changed files with 21 additions and 8 deletions

View file

@ -95,6 +95,9 @@ void SimulationLoader::basicPreprocessing(SimuData *d,
} }
filteredCopy(d->Id, accepted, d->NumPart); filteredCopy(d->Id, accepted, d->NumPart);
filteredCopy(d->type, accepted, d->NumPart); filteredCopy(d->type, accepted, d->NumPart);
filterAttribute<long>(d, "uniqueID", accepted, d->NumPart);
d->NumPart = numAccepted; d->NumPart = numAccepted;
delete[] accepted; delete[] accepted;
} }

View file

@ -110,17 +110,27 @@ public:
while (i < N) while (i < N)
{ {
if (!accepted[i]) if (!accepted[i])
{ {
i++; i++;
continue; continue;
} }
a[j] = a[i]; a[j] = a[i];
j++; j++;
i++; i++;
} }
} }
template<typename T>
void filterAttribute(CosmoTool::SimuData *d, const std::string& attrname, bool *accepted, long NumPart)
{
if (d->attributes.find(attrname) == d->attributes.end())
return;
long *l = d->as<T>(attrname);
filteredCopy<T>(l, accepted, NumPart);
}
}; };