3#include <Alembic/AbcGeom/All.h>
4#include <Alembic/AbcCoreOgawa/All.h>
5#include <Alembic/AbcCoreAbstract/Tests/Assert.h>
12#include <ImathRandom.h>
18 template<
typename TDataType>
24 template<
typename TDataType>
29 template<
typename TDataType>
32 if (time_idx % 8 != 0)
39 auto& inPos = this->inPointSet()->getDataPtr()->getPoints();
40 auto& inColor = this->inColor()->getData();
42 assert(inPos.size() == inColor.size());
44 std::stringstream ss; ss << m_output_index;
45 std::string filename = this->varOutputPath()->getData() + std::string(
"fluid_pos_") + ss.str() + std::string(
".abc");
47 Alembic::AbcGeom::OArchive archive(Alembic::AbcCoreOgawa::WriteArchive(),
49 Alembic::AbcGeom::OObject topObj(archive, Alembic::AbcGeom::kTop);
50 Alembic::AbcGeom::OPoints ptsObj(topObj,
"somePoints");
52 int total_num = inPos.size();
55 host_position.
resize(total_num);
56 host_mapping.
resize(total_num);
58 host_position.
assign(inPos);
59 host_mapping.
assign(inColor);
63 std::vector< Alembic::AbcGeom::V3f > positions;
64 std::vector< Alembic::AbcGeom::V3f > velocities;
65 std::vector< Alembic::Util::uint64_t > ids;
66 std::vector< Alembic::Util::float32_t > widths;
68 for (
int i = 0; i < total_num; i++)
70 positions.push_back(Alembic::AbcGeom::V3f(host_position[i][0], host_position[i][1], host_position[i][2]));
71 velocities.push_back(Alembic::AbcGeom::V3f(0, 0, 0));
73 widths.push_back(host_mapping[i]);
77 Alembic::AbcGeom::OFloatGeomParam::Sample widthSamp;
78 widthSamp.setScope(Alembic::AbcGeom::kVertexScope);
79 widthSamp.setVals(Alembic::AbcGeom::FloatArraySample(widths));
81 Alembic::AbcGeom::OPointsSchema::Sample psamp(Alembic::AbcGeom::V3fArraySample(positions),
82 Alembic::AbcGeom::UInt64ArraySample(ids), Alembic::AbcGeom::V3fArraySample(velocities),
85 ptsObj.getSchema().set(psamp);
87 host_position.
clear();
void assign(const T &val)
virtual ~ParticleWriterABC()
This is an implementation of AdditiveCCD based on peridyno.
IMPLEMENT_TCLASS(FloatingNumber, TDataType)
DEFINE_CLASS(CircularEmitter)