mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 23:31:12 +00:00
Filter uniqueID attribute
This commit is contained in:
parent
15e065a833
commit
5f332edf02
2 changed files with 21 additions and 8 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue