Continuum Membrane 719025a62b1e384a6ff80e2f2a223ef4012153dc
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
DynamicMesh Class Reference

A class representing a dynamic mesh. More...

#include <Dynamics.hpp>

Inheritance diagram for DynamicMesh:
Mesh

Public Member Functions

 DynamicMesh (Param &srcParam)
 Construct a new Dynamic Mesh object. Calls the parent constructor Mesh::Mesh(srcParam).
 
void setup_flat ()
 Overloads the setup_flat in superclass Mesh. Add functionality to assign mesh2surface and surface2mesh.
 
void assign_mesh2surface ()
 Assign the mesh2surface member.
 
void update_vertices_mat_with_vector ()
 Updates the vertices matrix using the values from the vertices vector.
 
void update_vertices_vector_with_mat ()
 Updates the vertices vector using the values from the vertices matrix.
 
void postprocess_ghost_periodic ()
 Post process ghost vertices in case of periodic boundary condition.
 
- Public Member Functions inherited from Mesh
 Mesh (Param &srcParam)
 Construct a new Mesh object with parameters. Initialize vertices and faces with other functions like setVerticesFlat.
 
 Mesh (const std::vector< Vertex > &srcVertices, const std::vector< Face > &srcFaces, Param &srcParam) __attribute__((deprecated("Initialize with Mesh(Param &srcParam) and setup with setup_from_vertices_faces instead.")))
 Construct a new mesh object with given vertices, faces, and parameters.
 
void setup_flat ()
 Initialize halfedges based on the mesh's vertices and faces.
 
void setup_from_vertices_faces (const std::vector< std::vector< double > > &verticesData, const std::vector< std::vector< int > > &facesData)
 Initialize membrane with arbitrary vertices and faces imported from files. Sets up the membrane from data and then call: (1) this->set_adjacent_faces_of_vertices_sorted (2) this->determine_ghost_vertices_faces.
 
void set_axes_division_flat ()
 Divide x,y axis to nx*dx (number of faces times length of each face) and ny*dy based on X, Y side length of the mesh and side length of faces in parameter. Note:
 
void set_vertices_faces_flat ()
 Set vertices and faces according to mesh and face side lengths in param for flat mesh. This also sets adjacent vertices of faces.
 
void set_adjacent_faces_of_vertices_sorted ()
 Set adjacentFaces properties based on the current vertices and mesh. Sort the adjacent vertices so that the adjacent vertices property of vertices follow the counterclockwise order and therefore the the adjacent faces with index number difference of one are adjacent to each other. This sorting streamlines the shapefunction calculation.
 
bool faces_share_edge (const Face &face1, const Face &face2)
 Return true if two faces share edge.
 
bool faces_share_edge (const Face &face1, const Face &face2, std::vector< int > &commonElements)
 Return true if two faces share edge. Store the vector of common elements in input commonElements.
 
void set_adjacent_faces_of_faces ()
 Set adjacentFaces properties of faces based on the current geometry of mesh.
 
void set_adjacent_vertices_of_vertices_sorted ()
 Set adjacentVertices of vertices based on current mesh.
 
int find_opposite_node_index (const int &node1, const int &node2, const int &node3)
 Find the vertex that is adjacent to node1 and node2 but not node3. Particularly, when the three nodes are vertices of a triangle, then the function returns the the index of node4 that forms a parallegram with 1->3->2->4.
 
void set_one_ring_vertices_sorted ()
 find out the one-ring vertices aound face_i. It should be 12 for the flat surface because we set it up only with regular patch. The boundary faces do not have complete one-ring, neither it will be called in the code, so no need to store their one-ring-vertex
 
void determine_boundary_vertices_faces ()
 Iterate through vertices and faces and set the isBoundary} property of boundary vertices and faces to true}.
 
void determine_ghost_vertices_faces ()
 Iterate through vertices and faces and set the isGhost property of ghost vertices and face to true. The number of layers of ghost vertices in a flat membrane is dependent upon the boundary conditions: free boundary condition has 1 layer of ghost vertices and faces while periodic bounary condition has 3 layers of ghost vertices.
 
void sort_vertices_on_faces ()
 Sort vertices on faces so that the unit normal vector indicates the orientation of the local patch of the membrane.
 
void set_insertion_patch (const vector< vector< int > > &insertionPatch)
 Sets the isInsertionPatch flag for each face in the insertion patch. This also sets with spontaneous curvature after setting the flag with set_spontaneous_curvature_for_face function.
 
void set_spontaneous_curvature_for_face (const double &insertCurv, const double &spontCurv)
 Sets the spontaneous curvature for each face in the mesh.
 
void calculate_element_area_volume ()
 Calculates the area and volume of each element in the mesh.
 
void sum_membrane_area_and_volume (double &area, double &volume)
 This function calculates the total membrane area and volume of non-ghost faces in a given set of faces.
 
void Compute_Energy_And_Force ()
 Computes the energy and force on each vertex and face of the mesh.
 
void element_energy_force_regular (const std::vector< Matrix > &coordOneRingVertices, Face &face, const double spontCurv, double &meanCurv, Matrix &normVector, double &eBend, Matrix &fBend, Matrix &fArea, Matrix &fVolume)
 The purpose of this function is to calculate the energy and forces for a regular element of a given mesh using the provided information about the element and its one-ring neighborhood.
 
void energy_force_regularization ()
 Calculates the regularization energy and force for each face.
 
void manage_force_for_boundary_ghost_vertex ()
 Manages forces depending on different boundary conditions.
 
double get_max_force_magnitude ()
 Get the max force scale of vertices.force.get_total_force_magnitude()
 
double calculate_mean_force ()
 Get the mean force magnitude on all vertices.
 
void update_previous_coord_for_vertex ()
 This function updates the coordPrev member variable for each vertex in the mesh. It does this by copying the current value of coord to coordPrev.
 
void update_reference_coord_from_previous_coord ()
 Update the reference coordinates for each vertex in the mesh.
 
void update_previous_force_for_vertex ()
 Update the previous force vectors for each vertex in the mesh.
 
void update_previous_energy_for_face ()
 Update the previous energy values for each face in the mesh.
 
void clear_force_on_vertices_and_energy_on_faces ()
 this function sets the force member variable of each vertex, and the energy member variable of each face to their default values. This is useful to clear out any residual forces or energies before computing new ones.
 
int findClosestRcap (double membraneCapRadius)
 
double interpolateHeight (double r, const std::vector< double > &r_vals, const std::vector< double > &h_vals)
 
void loadMembraneShapeProfile (double membraneCapRadius, std::vector< double > &r_vals, std::vector< double > &h_vals)
 
bool move_vertices_based_on_scaffolding (bool fixDir=true)
 This method takes in the vector of spline point and calculate the average coordinates. Based on the difference between spline points and mesh vertices, a difference vector is calculated and compared to the target bond length. (Supposed only in Z direction). Afterwards, all the mesh points are moved in the direction of the target difference vector.
 
Matrixfind_center_of_scaffolding_sphere (bool use_default)
 A function that finds the center of the scaffolding sphere. Currently the function assumes that the spherical cap is oriented in a way that the point with biggest z-coord corresponds to the x,y of the spherical center.
 
double approximate_scaffolding_cap_radius (bool use_default)
 Approximates the radius of the scaffolding cap.
 
void set_scaffolding_vertices_correspondence ()
 Get a vector of indexes of vertices that are closest to the scaffoldingPoints vector provided. Then set the param.scaffoldingPoints_correspondingVertexIndex} to represent the vertices bonded with each scaffolding point.
 
void set_scaffolding_insertion_curvature ()
 Sets insertion spontaneous curvature on faces adjacent to scaffold-bonded membrane vertices.
 
double calculate_scaffolding_energy_force (bool doLocalSearch)
 Calculates the energy and force due to the harmonic bond between scaffold points and membrane vertices.
 
bool initialize_gag_scaffolding_topology ()
 Initializes the Gag-specific reference geometry from the selected complex file.
 
bool orient_scaffolding_plane_to_membrane ()
 Orients the imported scaffold COM cloud so its best-fit plane is parallel to the membrane plane.
 
double calculate_gag_scaffolding_internal_energy () const
 Calculates the internal Gag scaffold energy for the current COM positions.
 
double calculate_gag_scaffolding_internal_energy (const std::vector< Matrix > &scaffoldingPoints) const
 Calculates the internal Gag scaffold energy for an arbitrary set of COM positions.
 
double calculate_gag_scaffolding_internal_energy (const std::vector< Matrix > &scaffoldingPoints, const std::vector< GagSubunit > &subunits) const
 Calculates the internal Gag scaffold energy for arbitrary COM positions and rigid-subunit orientations.
 
std::vector< Matrixcalculate_gag_scaffolding_forces_fd () const
 Computes per-point Gag scaffold forces using finite differences on the internal energy.
 
std::vector< Matrixcalculate_gag_subunit_translation_forces_fd ()
 Computes rigid-subunit COM translation forces from the Gag scaffold energy.
 
std::vector< Matrixcalculate_gag_subunit_rotation_torques_fd ()
 Computes rigid-subunit rotational torques from the Gag scaffold energy.
 
bool propagate_scaffolding ()
 Propagate the scaffolding based on energy and force calculated from calculate_scaffolding_energy_force(bool doLocalSearch).
 
bool pre_relax_gag_scaffolding ()
 Pre-relaxes the Gag scaffold using only internal Gag energy before membrane coupling is initialized.
 
void write_faces_csv (const std::string &outfile_name)
 Writes a csv file containing the adjacent vertices for each face in the mesh.
 
void write_vertices_csv (const std::string &outfile_name)
 Writes a csv file containing the coordinates of each vertex in the mesh.
 
void write_vertices_csv_with_type (const std::string &outfile_name)
 Writes a csv file containing the coordinates and types of each vertex in the mesh.
 
void write_gag_scaffolding_state_dat (const std::string &outfile_name) const
 Writes the current Gag scaffold state in a selected-complex style .dat layout.
 

Public Attributes

Matrix mesh2surface
 
Matrix surface2mesh
 
Matrix matMesh
 
Matrix matSurface
 
- Public Attributes inherited from Mesh
std::vector< Vertexvertices
 Vector to store all vertices in the mesh.
 
std::vector< Facefaces
 Vector to store all faces in the mesh.
 
Paramparam
 Object of the Param class containing all necessary parameters for building the Mesh object.
 
Matrix centerScaffoldingSphere
 Center of the scaffolding cap sphere.
 
Matrix forceTotalOnScaffolding
 Total force exerted on the scaffolding lattice.
 
Matrix scaffoldingMovementVector
 Vector representing the movement of scaffolding over the course of simulation.
 
std::vector< MatrixforceOnScaffoldingPoints
 Per-point force used when propagating the scaffold.
 
bool gagScaffoldingTopologyInitialized = false
 Whether Gag-specific reference geometry has been initialized.
 
std::vector< GagBondgagBonds
 Gag-specific COM bond list.
 
std::vector< GagAnglegagAngles
 Gag-specific COM angle list.
 
std::vector< GagTorsiongagTorsions
 Gag-specific COM torsion list.
 
std::vector< GagSubunitgagSubunits
 Gag rigid subunits whose COMs are the scaffolding points.
 
std::vector< GagInteractiongagInteractions
 Gag pair interactions defined on rigid subunits.
 
Matrix gagInitialAlignmentRotation = Matrix(3, 3, true)
 Initial lattice-to-membrane alignment rotation.
 

Protected Member Functions

int get_relative_pt_periodic (int i, int n, int m)
 calculate real point relative to the given ghost point (index(real) - index(given)) in periodic boundary condition returns 0 if real point (not on 4th ring) given an arbitrary real point is chosen if given 4th
 
- Protected Member Functions inherited from Mesh
void enumerate_gauss_quadrature_point_area_volume (const Matrix &dots, double &area, double &volume)
 Private member used in calculating element area volume: Calculates the area and volume at a Gauss quadrature point for a given set of shape functions and dots.
 
Matrix get_one_ring_vertex_matrix (const Face &face)
 Private member used in calculating element area volume: Computes a matrix containing the coordinates of the one-ring vertices for the input face.
 
double get_squared_distance_sp_and_v (const Matrix &scaffoldingPoint, const Vertex &vertex)
 Private member used in calculating correspondence between scaffolding points and vertices Calculate the squared distance between two points denoted by (3,1) Matrix and Vertex respectively.
 

Detailed Description

A class representing a dynamic mesh.

This class inherits from the Mesh class and adds functionality to simulate the mesh dynamically.

Constructor & Destructor Documentation

◆ DynamicMesh()

DynamicMesh::DynamicMesh ( Param srcParam)

Construct a new Dynamic Mesh object. Calls the parent constructor Mesh::Mesh(srcParam).

Parameters
srcParam

Member Function Documentation

◆ assign_mesh2surface()

void DynamicMesh::assign_mesh2surface ( )

Assign the mesh2surface member.

Assign values to mesh2surface matrix that convertes mesh to surface point matrix.

◆ get_relative_pt_periodic()

int DynamicMesh::get_relative_pt_periodic ( int  i,
int  n,
int  m 
)
protected

calculate real point relative to the given ghost point (index(real) - index(given)) in periodic boundary condition returns 0 if real point (not on 4th ring) given an arbitrary real point is chosen if given 4th

Parameters
i
n
m
Returns
int

◆ postprocess_ghost_periodic()

void DynamicMesh::postprocess_ghost_periodic ( )

Post process ghost vertices in case of periodic boundary condition.

Note
This function does not have check for PBC - it assumes the model is in PBC!

◆ setup_flat()

void DynamicMesh::setup_flat ( )

Overloads the setup_flat in superclass Mesh. Add functionality to assign mesh2surface and surface2mesh.

◆ update_vertices_mat_with_vector()

void DynamicMesh::update_vertices_mat_with_vector ( )

Updates the vertices matrix using the values from the vertices vector.

◆ update_vertices_vector_with_mat()

void DynamicMesh::update_vertices_vector_with_mat ( )

Updates the vertices vector using the values from the vertices matrix.

Member Data Documentation

◆ matMesh

Matrix DynamicMesh::matMesh

◆ matSurface

Matrix DynamicMesh::matSurface

◆ mesh2surface

Matrix DynamicMesh::mesh2surface

◆ surface2mesh

Matrix DynamicMesh::surface2mesh

The documentation for this class was generated from the following file: