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.

86 lines
1.6 KiB

4 months ago
#pragma once
#include <cstdint>
4 months ago
#include <algorithm>
#include <vector>
using std::vector;
4 months ago
struct Edge {
uint32_t a;
uint32_t b;
float length;
4 months ago
float compliance;
4 months ago
};
struct Face {
uint32_t a;
uint32_t b;
uint32_t c;
};
struct Triangle : Face {
float area;
4 months ago
float compliance;
4 months ago
};
struct Tetrahedron {
uint32_t a;
uint32_t b;
uint32_t c;
uint32_t d;
float volume;
4 months ago
float compliance;
4 months ago
};
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();
3 months ago
void insert(const ConstraintData &other);
4 months ago
private:
uint32_t prePartitionEdgeCount;
uint32_t prePartitionTetrahedronCount;
};
// The following classes are only for the graph coloring in pre-processing
4 months ago
struct Constraint {
virtual ~Constraint() {}
3 months ago
virtual void writeData(ConstraintData &dataLists) const {};
4 months ago
};
struct DistanceConstraint : Edge, Constraint {
explicit DistanceConstraint(const Edge &edge) : Edge(edge) {}
3 months ago
4 months ago
void writeData(ConstraintData &dataLists) const override;
};
struct AreaConstraint : Triangle, Constraint {
3 months ago
explicit AreaConstraint(const Triangle &triangle) : Triangle(triangle) {}
4 months ago
void writeData(ConstraintData &dataLists) const override;
};
struct VolumeConstraint : Tetrahedron, Constraint {
3 months ago
explicit VolumeConstraint(const Tetrahedron &tetrahedron) : Tetrahedron(tetrahedron) {}
4 months ago
void writeData(ConstraintData &dataLists) const override;
};