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

A class representing a triangular mesh that defines a limit surface. More...

#include <Mesh.hpp>

Inheritance diagram for Mesh:
DynamicMesh

Classes

struct  GagAngle
 
struct  GagBond
 
struct  GagInteraction
 
struct  GagReactionTarget
 
struct  GagSubunit
 
struct  GagTorsion
 

Public Member Functions

 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

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

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.
 

Friends

std::ostream & operator<< (std::ostream &stream, const Mesh &mesh)
 Overrides the operator << in ostream.
 

Detailed Description

A class representing a triangular mesh that defines a limit surface.

Constructor & Destructor Documentation

◆ Mesh() [1/2]

Mesh::Mesh ( Param srcParam)

Construct a new Mesh object with parameters. Initialize vertices and faces with other functions like setVerticesFlat.

Parameters
param

◆ Mesh() [2/2]

Mesh::Mesh ( const std::vector< Vertex > &  srcVertices,
const std::vector< Face > &  srcFaces,
Param srcParam 
) &

Construct a new mesh object with given vertices, faces, and parameters.

Deprecated:
This function is deprecated, initialize with Mesh(Param &srcParam) and setup with setup_from_vertices_faces instead.

Member Function Documentation

◆ approximate_scaffolding_cap_radius()

double Mesh::approximate_scaffolding_cap_radius ( bool  use_default)

Approximates the radius of the scaffolding cap.

This function approximates the radius of the scaffolding cap based on the furthest point from the center of the scaffolding sphere in terms of x and y coordinates.

Parameters
use_defaultFlag indicating whether to use the default center of scaffolding sphere. If set to true, the default center (0,0,0) will be used. If set to false, the center will be determined based on the maximum z-coordinate of the scaffolding points.
Returns
The radius of the scaffolding cap.

◆ calculate_element_area_volume()

void Mesh::calculate_element_area_volume ( )

Calculates the area and volume of each element in the mesh.

This method computes and sets the area and volume of each element in the mesh, where an "element" refers to a face in the mesh. The method uses Gaussian quadrature to calculate the area and volume of each element, with 3 points used for regular patches and multiple iterations of subdivision used for irregular patches.

The method first defines some matrices used for subdivision of the irregular patch, including M, M1, M2, M3, and M4. It then loops over all faces in the mesh in parallel using OpenMP.

For each face, the method checks whether it is a ghost face; if so, it skips to the next face. Otherwise, it initializes variables to accumulate the area and volume of the element and determines the number of one-ring vertices (nOneRingVertex) for the face.

If nOneRingVertex is equal to 12, the face corresponds to a regular patch, and the method calls the get_one_ring_vertex_matrix function to compute a matrix representing the coordinates of the one-ring vertices. It then uses Gaussian quadrature with 3 points to compute the area and volume of the element.

If nOneRingVertex is equal to 11, the face corresponds to an irregular patch. In this case, the method again calls get_one_ring_vertex_matrix to compute the matrix of one-ring vertex coordinates, but then performs multiple iterations of subdivision using the M, M1, M2, M3, and M4 matrices to estimate the area and volume of the element.

Finally, the method sets the elementArea and elementVolume member variables of the face to the computed area and volume, respectively.

◆ calculate_gag_scaffolding_forces_fd()

std::vector< Matrix > Mesh::calculate_gag_scaffolding_forces_fd ( ) const

Computes per-point Gag scaffold forces using finite differences on the internal energy.

Returns
std::vector<Matrix> The negative energy gradient on each scaffold point.

◆ calculate_gag_scaffolding_internal_energy() [1/3]

double Mesh::calculate_gag_scaffolding_internal_energy ( ) const

Calculates the internal Gag scaffold energy for the current COM positions.

Returns
double The internal Gag scaffold energy.

◆ calculate_gag_scaffolding_internal_energy() [2/3]

double Mesh::calculate_gag_scaffolding_internal_energy ( const std::vector< Matrix > &  scaffoldingPoints) const

Calculates the internal Gag scaffold energy for an arbitrary set of COM positions.

Parameters
scaffoldingPointsThe scaffold COM positions to evaluate.
Returns
double The internal Gag scaffold energy.

◆ calculate_gag_scaffolding_internal_energy() [3/3]

double Mesh::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.

Parameters
scaffoldingPointsThe scaffold COM positions to evaluate.
subunitsThe rigid-subunit states to evaluate.
Returns
double The internal Gag scaffold energy.

◆ calculate_gag_subunit_rotation_torques_fd()

std::vector< Matrix > Mesh::calculate_gag_subunit_rotation_torques_fd ( )

Computes rigid-subunit rotational torques from the Gag scaffold energy.

◆ calculate_gag_subunit_translation_forces_fd()

std::vector< Matrix > Mesh::calculate_gag_subunit_translation_forces_fd ( )

Computes rigid-subunit COM translation forces from the Gag scaffold energy.

◆ calculate_mean_force()

double Mesh::calculate_mean_force ( )

Get the mean force magnitude on all vertices.

Returns
mean force magnitude

◆ calculate_scaffolding_energy_force()

double Mesh::calculate_scaffolding_energy_force ( bool  doLocalSearch)

Calculates the energy and force due to the harmonic bond between scaffold points and membrane vertices.

Parameters
doLocalSearchFlag indicating whether or not to perform a local search for each vertex (default=false).
Returns
double The total energy of the system due to the scaffold-membrane interactions.

The function iterates over each scaffold point, calculates the distance between the point and its corresponding vertex, and calculates the energy and force due to the harmonic bond between the two. If the energy flag is not set to include harmonic bonding, the function returns 0.

Parameters
[in]doLocalSearchFlag to indicate whether a local search should be performed for each vertex (default=false).
Note
The energy is calculated according to the formula: E = 0.5 * k * (r - l)^2, where k is the spring constant, r is the distance between the scaffold point and vertex, and l is the resting length of the bond.
The force is calculated according to the formula: F = -k * (r - l) * (unit vector pointing from vertex to scaffold point).
If the distance between the scaffold point and vertex is negative, the force is multiplied by -1 in order to prevent overlapping between the scaffold and membrane.
If the verbose flag is set, the function prints out information about each vertex's force due to the scaffold-membrane bond.

◆ clear_force_on_vertices_and_energy_on_faces()

void Mesh::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.

◆ Compute_Energy_And_Force()

void Mesh::Compute_Energy_And_Force ( )

Computes the energy and force on each vertex and face of the mesh.

This function performs the following steps: Calculates the area and volume of each element triangle and sums up the total area and volume of the membrane. Iterates through faces and calculates the energy and force on each triangular patch. Regularizes the force and energy. Sums up the energy and force on each vertex and face. Calculates the energy due to area constraint. Calculates the energy due to volume constraint. Calculates the energy due to scaffolding.

Returns
void

◆ determine_boundary_vertices_faces()

void Mesh::determine_boundary_vertices_faces ( )

Iterate through vertices and faces and set the isBoundary} property of boundary vertices and faces to true}.

Deprecated:
Currently the isBoundary property is not used in any part of the model. This is a placeholder in case any future functions need the property.

◆ determine_ghost_vertices_faces()

void Mesh::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.

◆ element_energy_force_regular()

void Mesh::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.

Parameters
coordOneRingVerticesa constant reference to a vector of matrices representing the coordinates of the vertices in the mesh's one-ring neighborhood.
spontCurva constant double representing the spontaneous curvature.
meanCurva non-constant double reference representing the mean curvature of the element.
normVectora non-constant matrix reference representing the normal vector of the element.
eBenda non-constant double reference representing the bending energy of the element.
fBenda non-constant matrix reference representing the bending force of the element.
fAreaa non-constant matrix reference representing the area constraint force of the element.
fVolumea non-constant matrix reference representing the volume constraint force of the element.

◆ energy_force_regularization()

void Mesh::energy_force_regularization ( )

Calculates the regularization energy and force for each face.

This function calculates the regularization energy and force for each face in the mesh. The regularization energy is calculated based on the deformation of the face's shape and area relative to an equilateral triangle with the same side length. The regularization force is then calculated based on the energy and applied to the vertices of the face. The function also updates the deformation counts for shapes and areas.

Returns
void

◆ enumerate_gauss_quadrature_point_area_volume()

void Mesh::enumerate_gauss_quadrature_point_area_volume ( const Matrix dots,
double &  area,
double &  volume 
)
protected

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.

Parameters
dotsThe matrix of dots representing the coordinates of the quadrature point.
gaussQuadratureCoeffThe matrix of Gauss quadrature coefficients.
areaA reference to a double variable storing the accumulated area.
volumeA reference to a double variable storing the accumulated volume.

◆ faces_share_edge() [1/2]

bool Mesh::faces_share_edge ( const Face face1,
const Face face2 
)

Return true if two faces share edge.

Note
Will also return true if face1 and face2 are the same face.
This function overloads faces_share_edge(const Face& face1, const Face& face2, )
Parameters
face1
face2
Returns
true
false

◆ faces_share_edge() [2/2]

bool Mesh::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.

Note
Will also return true if face1 and face2 are the same face.
Used in set_adjacent_faces_of_faces()
see faces_share_edge(const Face& face1, const Face& face2, )
Parameters
face1
face2
commonElements
Returns
true
false

◆ find_center_of_scaffolding_sphere()

Matrix & Mesh::find_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.

Note
this function does NOT find the radius of the sphere. It takes in the gag sphere radius from the parameter structure in mesh (this->param).
Parameters
use_defaultif set to true, the function with return the defautl center of scaffolding sphere (0, 0, 0)
Returns
instance of Matrix(3, 1) that represents the center of scaffolding sphere.

◆ find_opposite_node_index()

int Mesh::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.

Parameters
node1
node2
node3
Returns
int vertex index

◆ findClosestRcap()

int Mesh::findClosestRcap ( double  membraneCapRadius)

◆ get_max_force_magnitude()

double Mesh::get_max_force_magnitude ( )

Get the max force scale of vertices.force.get_total_force_magnitude()

Returns
double max force magnitude

◆ get_one_ring_vertex_matrix()

Matrix Mesh::get_one_ring_vertex_matrix ( const Face face)
protected

Private member used in calculating element area volume: Computes a matrix containing the coordinates of the one-ring vertices for the input face.

◆ get_squared_distance_sp_and_v()

double Mesh::get_squared_distance_sp_and_v ( const Matrix scaffoldingPoint,
const Vertex vertex 
)
protected

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.

Returns
the squared distance

◆ initialize_gag_scaffolding_topology()

bool Mesh::initialize_gag_scaffolding_topology ( )

Initializes the Gag-specific reference geometry from the selected complex file.

Returns
true if the topology was successfully initialized
false otherwise

◆ interpolateHeight()

double Mesh::interpolateHeight ( double  r,
const std::vector< double > &  r_vals,
const std::vector< double > &  h_vals 
)

◆ loadMembraneShapeProfile()

void Mesh::loadMembraneShapeProfile ( double  membraneCapRadius,
std::vector< double > &  r_vals,
std::vector< double > &  h_vals 
)

◆ manage_force_for_boundary_ghost_vertex()

void Mesh::manage_force_for_boundary_ghost_vertex ( )

Manages forces depending on different boundary conditions.

This method sets the force of nodes that are part of the mesh's boundaries and ghost vertices to zero, based on the type of boundary condition specified in the input parameters.

Note
See enum BoundaryType in Parameters.hpp

◆ move_vertices_based_on_scaffolding()

bool Mesh::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.

Parameters
fixDirdefault to true; fix move vector to (0, 0, 50) if set to true; otherwise move vector is determined based on average scaffolding points
Returns
true if success

◆ orient_scaffolding_plane_to_membrane()

bool Mesh::orient_scaffolding_plane_to_membrane ( )

Orients the imported scaffold COM cloud so its best-fit plane is parallel to the membrane plane.

◆ pre_relax_gag_scaffolding()

bool Mesh::pre_relax_gag_scaffolding ( )

Pre-relaxes the Gag scaffold using only internal Gag energy before membrane coupling is initialized.

Returns
true if a pre-relaxation stage was executed
false otherwise

◆ propagate_scaffolding()

bool Mesh::propagate_scaffolding ( )

Propagate the scaffolding based on energy and force calculated from calculate_scaffolding_energy_force(bool doLocalSearch).

Returns
true if success
false

◆ set_adjacent_faces_of_faces()

void Mesh::set_adjacent_faces_of_faces ( )

Set adjacentFaces properties of faces based on the current geometry of mesh.

This function iterates over the faces of the mesh and populates the adjacentFaces property of each face by finding neighboring faces that share an edge.

◆ set_adjacent_faces_of_vertices_sorted()

void Mesh::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.

◆ set_adjacent_vertices_of_vertices_sorted()

void Mesh::set_adjacent_vertices_of_vertices_sorted ( )

Set adjacentVertices of vertices based on current mesh.

Todo:
Sorting to be implemented.

◆ set_axes_division_flat()

void Mesh::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:

(1) y-axis is in a zig-zag shape and in perpendicular direction, h(y) = sqrt(3)/2 * h(x) assuming equilateral triangles (2) number of vertices along axes = number of faces (edges) + 1

◆ set_insertion_patch()

void Mesh::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.

Parameters
insertionPatchA vector of vectors containing the indices of faces in the insertion patch

◆ set_one_ring_vertices_sorted()

void Mesh::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

◆ set_scaffolding_insertion_curvature()

void Mesh::set_scaffolding_insertion_curvature ( )

Sets insertion spontaneous curvature on faces adjacent to scaffold-bonded membrane vertices.

◆ set_scaffolding_vertices_correspondence()

void Mesh::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.

◆ set_spontaneous_curvature_for_face()

void Mesh::set_spontaneous_curvature_for_face ( const double &  insertCurv,
const double &  spontCurv 
)

Sets the spontaneous curvature for each face in the mesh.

This method sets the "spontaneous curvature" of each face in the mesh, which is a parameter used to describe the shape and behavior of lipid membranes. The spontaneous curvature can be different for faces inside and outside of an "insertion patch," which are specified by the insertCurv and spontCurv parameters, respectively.

The method takes two double parameters: insertCurv and spontCurv. The former specifies the spontaneous curvature for faces within the insertion patch, while the latter specifies the spontaneous curvature for faces outside of the insertion patch.

The method loops over all faces in the mesh and sets the spontCurvature member variable of each face to either insertCurv or spontCurv, depending on whether the face is part of the insertion patch or not.

Parameters
insertCurvThe spontaneous curvature for faces in the insertion patch
spontCurvThe spontaneous curvature for faces outside the insertion patch

◆ set_vertices_faces_flat()

void Mesh::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.

◆ setup_flat()

void Mesh::setup_flat ( )

Initialize halfedges based on the mesh's vertices and faces.

Helper function to create a new halfedge.

Parameters
vertexIndexIndex of the vertex associated with the halfedge.
faceIndexIndex of the face associated with the halfedge.
Returns
Halfedge* Pointer to the created halfedge.

Initialize flat membrane with properities specified in the param} member variable. Equivalent to call: (1) this->set_axes_division_flat (2) this->set_vertices_faces_flat (3) this->set_adjacent_faces_of_vertices_sorted (4) this->determine_ghost_vertices_faces

◆ setup_from_vertices_faces()

void Mesh::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.

Parameters
verticesData2D double vector containing the coordinates of vertices
facesData2D int vector containing the indices of vertices on each face

◆ sort_vertices_on_faces()

void Mesh::sort_vertices_on_faces ( )

Sort vertices on faces so that the unit normal vector indicates the orientation of the local patch of the membrane.

For example, if a face has vertices A->B->C, then the unit normal vector is calculated as AB x BC. This follows a "half-edge" data structure: if face ABC and face BCD shares edge BC, and ABC has vertices A->B->C, then on BCD, the edge sequence of BC needs to be reverse and therefore BCD has vertices C->B->D.

◆ sum_membrane_area_and_volume()

void Mesh::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.

Note
This function only sums up to element area and volume of all faces. It does not update the element area and volume based on the current state of the mesh. If you need to update and calculate the total area and volume of the mesh, please call calculate_element_area_volume first before calling this function.
Parameters
areaa reference to a double variable to store the computed area
volumea reference to a double variable to store the computed volume

◆ update_previous_coord_for_vertex()

void Mesh::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.

◆ update_previous_energy_for_face()

void Mesh::update_previous_energy_for_face ( )

Update the previous energy values for each face in the mesh.

The energyPrev member variable for each face is updated with the current value of energy.

◆ update_previous_force_for_vertex()

void Mesh::update_previous_force_for_vertex ( )

Update the previous force vectors for each vertex in the mesh.

The forcePrev member variable for each vertex is updated with the current value of force.

◆ update_reference_coord_from_previous_coord()

void Mesh::update_reference_coord_from_previous_coord ( )

Update the reference coordinates for each vertex in the mesh.

The coordRef member variable for each vertex is updated with the current value of coordPrev.

◆ write_faces_csv()

void Mesh::write_faces_csv ( const std::string &  outfile_name)

Writes a csv file containing the adjacent vertices for each face in the mesh.

Parameters
outfile_nameThe name of the output csv file

◆ write_gag_scaffolding_state_dat()

void Mesh::write_gag_scaffolding_state_dat ( const std::string &  outfile_name) const

Writes the current Gag scaffold state in a selected-complex style .dat layout.

Parameters
outfile_nameThe name of the output .dat file

◆ write_vertices_csv()

void Mesh::write_vertices_csv ( const std::string &  outfile_name)

Writes a csv file containing the coordinates of each vertex in the mesh.

Parameters
outfile_nameThe name of the output csv file

◆ write_vertices_csv_with_type()

void Mesh::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.

Parameters
outfile_nameThe name of the output csv file

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  stream,
const Mesh mesh 
)
friend

Overrides the operator << in ostream.

Member Data Documentation

◆ centerScaffoldingSphere

Matrix Mesh::centerScaffoldingSphere

Center of the scaffolding cap sphere.

◆ faces

std::vector<Face> Mesh::faces

Vector to store all faces in the mesh.

◆ forceOnScaffoldingPoints

std::vector<Matrix> Mesh::forceOnScaffoldingPoints

Per-point force used when propagating the scaffold.

◆ forceTotalOnScaffolding

Matrix Mesh::forceTotalOnScaffolding

Total force exerted on the scaffolding lattice.

◆ gagAngles

std::vector<GagAngle> Mesh::gagAngles

Gag-specific COM angle list.

◆ gagBonds

std::vector<GagBond> Mesh::gagBonds

Gag-specific COM bond list.

◆ gagInitialAlignmentRotation

Matrix Mesh::gagInitialAlignmentRotation = Matrix(3, 3, true)

Initial lattice-to-membrane alignment rotation.

◆ gagInteractions

std::vector<GagInteraction> Mesh::gagInteractions

Gag pair interactions defined on rigid subunits.

◆ gagScaffoldingTopologyInitialized

bool Mesh::gagScaffoldingTopologyInitialized = false

Whether Gag-specific reference geometry has been initialized.

◆ gagSubunits

std::vector<GagSubunit> Mesh::gagSubunits

Gag rigid subunits whose COMs are the scaffolding points.

◆ gagTorsions

std::vector<GagTorsion> Mesh::gagTorsions

Gag-specific COM torsion list.

◆ param

Param& Mesh::param

Object of the Param class containing all necessary parameters for building the Mesh object.

◆ scaffoldingMovementVector

Matrix Mesh::scaffoldingMovementVector

Vector representing the movement of scaffolding over the course of simulation.

◆ vertices

std::vector<Vertex> Mesh::vertices

Vector to store all vertices in the mesh.


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