PeriDyno 0.9.2
Loading...
Searching...
No Matches
VolumeUniformGenerator.h
Go to the documentation of this file.
1
16#pragma once
17
18#include "VolumeOctree.h"
19
21#include "Topology/TriangleSet.h"
23#include "Vector.h"
24
25
26namespace dyno
27{
29 {
30 public:
31
32 DYN_FUNC bool operator< (const UniformNode& ug) const
33 {
34 return position_index < ug.position_index;
35 }
36
37 DYN_FUNC void set_value(int surf, int pos)
38 {
40 position_index = pos;
41 }
42
43 int surface_index = -1;
45 };
46
47 struct NodeCmp
48 {
49 DYN_FUNC bool operator()(const UniformNode& A, const UniformNode& B)
50 {
51 return A < B;
52 }
53 };
54
55 template<typename TDataType>
56 class VolumeUniformGenerator :public VolumeOctree<TDataType>
57 {
59 public:
60 typedef typename TDataType::Real Real;
61 typedef typename TDataType::Coord Coord;
63
64
67
68 void load(std::string filename);
69
70 void resetStates() override;
71 void updateStates() override;
72
74
75 DYN_FUNC inline Real Dx() const { return m_dx; }
76 DYN_FUNC inline Coord Origin() const { return m_origin; }
77 DYN_FUNC inline int nx() const { return m_nx; }
78 DYN_FUNC inline int ny() const { return m_ny; }
79 DYN_FUNC inline int nz() const { return m_nz; }
80
82
83 private:
84
85 DEF_INSTANCE_IN(TriangleSet<TDataType>, TriangleSet, "The triangles of closed surface");
86
87 DEF_VAR(Real, Spacing, 1.0, "the dx");
88
90
91 DEF_VAR(Coord, AnchorOrigin, 0, "Anchor origin");
92
93 DEF_VAR(Coord, ForwardVector, 0, "The distance and direction of topology move");
94
95 DEF_VAR_OUT(Coord, UniformOrigin, "Uniform grids origin");
99
100 private:
101
104 int m_nx;
105 int m_ny;
106 int m_nz;
107 };
108}
#define DECLARE_TCLASS(name, T1)
Definition Object.h:87
DYN_FUNC bool operator<(const UniformNode &ug) const
DYN_FUNC void set_value(int surf, int pos)
DEF_VAR_OUT(Coord, UniformOrigin, "Uniform grids origin")
DEF_VAR(Real, Spacing, 1.0, "the dx")
void getSignDistance(DArray< Coord > point_pos, DArray< Real > &point_sdf)
DEF_VAR(uint, Padding, 1, "")
TopologyModule::Triangle Triangle
DEF_INSTANCE_IN(TriangleSet< TDataType >, TriangleSet, "The triangles of closed surface")
void load(std::string filename)
DEF_VAR(Coord, ForwardVector, 0, "The distance and direction of topology move")
void updateStates() override
DEF_VAR(Coord, AnchorOrigin, 0, "Anchor origin")
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:24
ArrayMap< T, DeviceType::GPU > DArrayMap
Definition ArrayMap.inl:80
unsigned int uint
Definition VkProgram.h:14
DYN_FUNC bool operator()(const UniformNode &A, const UniformNode &B)