You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

77 lines
1.5 KiB

#pragma once
#include <cstdint>
#include <algorithm>
#include <vector>
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<Edge> edges;
vector<Triangle> triangles;
vector<Tetrahedron> tetrahedra;
struct Partition {
uint32_t offset;
uint32_t size;
};
uint32_t partitionCount;
vector<Partition> edgePartitions;
vector<Partition> trianglePartitions;
vector<Partition> tetrahedronPartitions;
void recordNewPartition();
void writePartitionInformation();
private:
uint32_t prePartitionEdgeCount;
uint32_t prePartitionTetrahedronCount;
};
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;
};