#pragma once #include #include #include using std::vector; struct Edge { uint32_t a; uint32_t b; float length; float compliance; }; struct Face { uint32_t a; uint32_t b; uint32_t c; }; struct Triangle : Face { float area; float compliance; }; struct Tetrahedron { uint32_t a; uint32_t b; uint32_t c; uint32_t d; float volume; float compliance; }; struct ConstraintData { vector edges; vector triangles; vector tetrahedra; struct Partition { uint32_t offset; uint32_t size; }; uint32_t partitionCount; vector edgePartitions; vector trianglePartitions; vector tetrahedronPartitions; void recordNewPartition(); void writePartitionInformation(); void insert(const ConstraintData& other); private: uint32_t prePartitionEdgeCount; uint32_t prePartitionTetrahedronCount; }; // The following classes are only for the graph coloring in pre-processing struct Constraint { virtual ~Constraint() {} virtual void writeData(ConstraintData& dataLists) const {}; }; struct DistanceConstraint : Edge, Constraint { explicit DistanceConstraint(const Edge &edge) : Edge(edge) {} void writeData(ConstraintData &dataLists) const override; }; struct AreaConstraint : Triangle, Constraint { explicit AreaConstraint(const Triangle& triangle) : Triangle(triangle) {} void writeData(ConstraintData &dataLists) const override; }; struct VolumeConstraint : Tetrahedron, Constraint { explicit VolumeConstraint(const Tetrahedron& tetrahedron) : Tetrahedron(tetrahedron) {} void writeData(ConstraintData &dataLists) const override; };