-
Notifications
You must be signed in to change notification settings - Fork 14
Instructions
To use the DSC method, simply follow these few steps:
It is recommended to use the setup (drawing, logging etc.) provided in the DEMO folder (the demo.cpp, user_interface.h, user_interface.cpp and draw.h source files). However, if you want another setup, you can use the default setup as starting point.
Create a your own velocity function class which extends the VelocityFunc class. This class should as minimum override the get_name() and deform() functions. The get_name() function should return a string with the name of the velocity function and the deform() function should have the following signature:
-
For each interface node **n** in the dsc-
Calculate a new position **p** according to the velocity function -
Call `set_destination(n, p)`
-
-
Call `deform()`
Three examples of velocity functions can be found in the repository in the DEMO folder: A rotation function (rotate_function.h), a function which smooths the model (average_function.h) and a function which moves the interface in the normal direction (normal_function.h).
Several default initialisation functions are provided with the DEMO application (for example rotate_cube(), smooth_armadillo() and expand_armadillo()). Use these as your starting point when creating a new initialisation function. An initialisation function should contain the following:
- Generate (using the Tetralizer class) or import (using the
import_tet_mesh_()function) a 3D model. - Optional: Create a new instance of the DesignDomain class (defining the design domain).
- Create a new instance of the DeformableSimplicialComplex class.
- Create a new instance of a velocity function class (for example the one created in step 2).
- Optional: Create a new instance of the Log class.
Note: If you use the default setup in the DEMO application, you have to add the initialisation function to the keyboard_() function.
If your application requires attributes to be stored at each simplex (each node, edge, face or tetrahedron), extend the corresponding attribute class found in attributes.h and give this as a template parameter when instantiating the DeformableSimplicialComplex class instead of the default attribute class. For example, let us say that our application requires a double value called x to be stored at each node. We then extend the NodeAttributes class and add x as a variable to this new class. This could look like this:
template<typename MT>
class MyNodeAttributes: public NodeAttributes<MT> {
double x;
public:
double get_x(){
return x;
}
void set_x(double _x) {
x = _x;
}
};
We then give MyNodeAttributes as a template parameter to the DeformableSimplicialComplex class instead of the default NodeAttributes class:
dsc = new DeformableSimplicialComplex<MT, MyNodeAttributes<MT>>(DISCRETIZATION, points, tets, tet_labels);
When the DeformableSimplicialComplex object is constructed, several parameters are set to control the min/max edge length, min/max angle etc. of the simplicial complex. You can change these parameters by extending the DeformableSimplicialComplex class and override the constructor.