LifeV
LifeV::ElectrophysiologyUtility Namespace Reference

Typedefs

typedef std::unordered_set< IDneighbors_Type
 
typedef std::vector< neighbors_TypeneighborList_Type
 

Methods

HeartUtility

Author
(s) Simone Rossi

HeartUtility contains methods for reading vectorial data from different formats to VectorEpetra objects.

typedef std::function< Real(const Real &t, const Real &x, const Real &y, const Real &z, const ID &i) > function_Type
 
template<typename Mesh >
void appliedCurrentClosestPointWithinRadius (std::vector< Real > &point, Real Radius, std::shared_ptr< VectorEpetra > appliedCurrentVector, Real valueAppliedCurrent, std::shared_ptr< Mesh > fullMesh, std::shared_ptr< Epetra_Comm > Comm)
 Find closest point within radius and applied a constant current. More...
 
template<typename Mesh >
void appliedCurrentPointsWithinRadius (std::vector< Real > &point, Real Radius, std::shared_ptr< VectorEpetra > appliedCurrentVector, Real valueAppliedCurrent, std::shared_ptr< Mesh > fullMesh)
 Find all the points within radius and applied a constant current. More...
 
template<typename Mesh >
UInt findClosestPoint (std::vector< Real > &point, std::shared_ptr< VectorEpetra > vec, std::shared_ptr< Mesh > fullMesh, std::shared_ptr< Epetra_Comm > Comm)
 Find closest point to a given one in the mesh. More...
 
template<typename Mesh >
void allIdsPointsWithGivenFlag (std::vector< ID > &containerIds, UInt flag, std::shared_ptr< VectorEpetra > vec, std::shared_ptr< Mesh > fullMesh)
 Collect all the ids of points with a given flag in a local vector for each processor. More...
 
template<typename Type >
Type randomPointInSet (std::vector< Type > &container)
 Select randomly a value in a given set and update the set by deleting the chosen value from the set. More...
 
void randomPointInSetAndNeighborhood (std::vector< ID > &container, std::vector< ID > &selectedPoints, neighborList_Type &neighbors)
 Select randomly a point in a given set and its neighborhood and update the set by deleting the chosen value from the set. More...
 
template<typename Type >
void randomNPointsInSet (std::vector< Type > &container, std::vector< Type > &selectedValue, UInt N)
 Select randomly N values in a given set and update the set by deleting the chosen N values from the set. More...
 
template<typename Mesh >
void randomNPointsInSetAndNeighborhood (std::vector< ID > &container, std::vector< ID > &selectedValue, std::vector< Real > &activationTime, Real deltaT, UInt N, Mesh &fullMesh, std::shared_ptr< Epetra_Comm > Comm)
 Select randomly N values in a given set and update the set by deleting the chosen N values from the set. More...
 
template<typename Type >
void applyCurrentGivenSetOfPoints (std::vector< Type > &container, std::shared_ptr< VectorEpetra > appliedCurrentVector, Real valueAppliedCurrent)
 Apply given current to a set of points. More...
 
template<typename Type >
void applyCurrentGivenSetOfPoints (std::vector< Type > &container, std::vector< Real > activationTime, std::shared_ptr< VectorEpetra > appliedCurrentVector, std::vector< Real > &valueAppliedCurrent, std::vector< UInt > &shiftVector, Real currentTime)
 Apply given current with a set of PMJs. More...
 
template<typename Mesh >
void importFibers (std::shared_ptr< VectorEpetra > fiberVector, const std::string &fileName, std::shared_ptr< Mesh > localMesh, const std::string &filePath="./")
 Read fiber vector field from HDF5 file. More...
 
template<typename Mesh >
void importScalarField (std::shared_ptr< VectorEpetra > vector, const std::string &fileName, const std::string &fieldName, std::shared_ptr< Mesh > localMesh)
 Read scalar field from HDF5 file. More...
 
template<typename Mesh >
void importVectorField (std::shared_ptr< VectorEpetra > vector, const std::string &fileName, const std::string &fieldName, std::shared_ptr< Mesh > localMesh, const std::string &postDir="./")
 Read vector field from HDF5 file. More...
 
void importFibersFromTextFile (std::shared_ptr< VectorEpetra > fiberVector, std::string fileName, std::string filePath, int format=0)
 Read fiber field from text file. More...
 
void setupFibers (VectorEpetra &fiberVector, VectorSmall< 3 > &fiberDirection)
 Setup fiber field from unidirectional VectorSmall object. More...
 
void setupFibers (VectorEpetra &fiberVector, std::vector< Real > &fiberDirection)
 Setup fiber field from unidirectional std::vector object. More...
 
void setupFibers (VectorEpetra &fiberVector, Real fx, Real fy, Real fz)
 Setup fiber field from three real components. More...
 
void setValueOnBoundary (VectorEpetra &vec, std::shared_ptr< RegionMesh< LinearTetra > > fullMesh, Real value, UInt flag)
 On the boundary with the specified flag, set the wanted value. More...
 
void setValueOnBoundary (VectorEpetra &vec, std::shared_ptr< RegionMesh< LinearTetra > > fullMesh, Real value, std::vector< UInt > flags)
 On the boundary with the specified flags, set the wanted value. More...
 
void rescaleVector (VectorEpetra &vector, Real minValue, Real maxValue, Real scaleFactor=1.0)
 Rescale a scalar field to be between requested bounds. More...
 
void rescaleVector (VectorEpetra &vector, Real scaleFactor=1.0)
 Rescale a scalar field by a constant factor. More...
 
void rescaleVectorOnBoundary (VectorEpetra &vector, std::shared_ptr< RegionMesh< LinearTetra > > fullMesh, UInt flag, Real scaleFactor=1.0)
 Rescale a scalar field by a constant factor on a boundary. More...
 
void normalize (VectorEpetra &vector)
 Normalizes a vector field to unit length. More...
 
void addNoiseToFibers (VectorEpetra &fiberVector, Real magnitude=0.01, std::vector< bool > component=std::vector< bool >(3, true))
 Add random component to the fibers. More...
 
template<typename Mesh >
void setFibersFromFunction (std::shared_ptr< VectorEpetra > vector, std::shared_ptr< Mesh > localMesh, function_Type f)
 

Typedef Documentation

◆ neighbors_Type

typedef std::unordered_set<ID> neighbors_Type

Definition at line 64 of file ElectrophysiologyUtility.hpp.

◆ neighborList_Type

typedef std::vector<neighbors_Type> neighborList_Type

Definition at line 65 of file ElectrophysiologyUtility.hpp.

◆ function_Type

typedef std::function< Real (const Real& t, const Real& x, const Real& y, const Real& z, const ID& i ) > function_Type

Definition at line 481 of file HeartUtility.hpp.

Function Documentation

◆ appliedCurrentClosestPointWithinRadius()

void LifeV::ElectrophysiologyUtility::appliedCurrentClosestPointWithinRadius ( std::vector< Real > &  point,
Real  Radius,
std::shared_ptr< VectorEpetra appliedCurrentVector,
Real  valueAppliedCurrent,
std::shared_ptr< Mesh >  fullMesh,
std::shared_ptr< Epetra_Comm >  Comm 
)
inline

Find closest point within radius and applied a constant current.

Parameters
pointVector of real containing the coordinates of the point within the radius
radiusRadius used to find point.
appliedCurrentVectorVector epetra containing the applied current.
valueAppliedCurrentValue of the current to apply at the specified point.
fullMeshPointer to the mesh.
CommEpetraMpi comunicator.

Definition at line 87 of file ElectrophysiologyUtility.hpp.

◆ appliedCurrentPointsWithinRadius()

void LifeV::ElectrophysiologyUtility::appliedCurrentPointsWithinRadius ( std::vector< Real > &  point,
Real  Radius,
std::shared_ptr< VectorEpetra appliedCurrentVector,
Real  valueAppliedCurrent,
std::shared_ptr< Mesh >  fullMesh 
)
inline

Find all the points within radius and applied a constant current.

Parameters
pointVector of real containing the coordinates of the point within the radius
radiusRadius used to find point.
appliedCurrentVectorVector epetra containing the applied current.
valueAppliedCurrentValue of the current to apply at the specified point.
fullMeshPointer to the mesh.

Definition at line 130 of file ElectrophysiologyUtility.hpp.

◆ findClosestPoint()

UInt LifeV::ElectrophysiologyUtility::findClosestPoint ( std::vector< Real > &  point,
std::shared_ptr< VectorEpetra vec,
std::shared_ptr< Mesh >  fullMesh,
std::shared_ptr< Epetra_Comm >  Comm 
)
inline

Find closest point to a given one in the mesh.

Parameters
pointVector of real containing the coordinates of the point within the radius
vecVector epetra used to recover Global id.
fullMeshPointer to the mesh.
CommEpetraMpi comunicator.
Returns
The ids of the closest point

Definition at line 167 of file ElectrophysiologyUtility.hpp.

◆ allIdsPointsWithGivenFlag()

void LifeV::ElectrophysiologyUtility::allIdsPointsWithGivenFlag ( std::vector< ID > &  containerIds,
UInt  flag,
std::shared_ptr< VectorEpetra vec,
std::shared_ptr< Mesh >  fullMesh 
)
inline

Collect all the ids of points with a given flag in a local vector for each processor.

Parameters
containerIdsVector containig all the ids of the points with a given flag
flagFlag.
vecVector epetra used to recover Global id.
fullMeshPointer to the mesh.

Definition at line 212 of file ElectrophysiologyUtility.hpp.

◆ randomPointInSet()

Type LifeV::ElectrophysiologyUtility::randomPointInSet ( std::vector< Type > &  container)
inline

Select randomly a value in a given set and update the set by deleting the chosen value from the set.

Parameters
containervector containig all the value
Returns
Selected value

Definition at line 228 of file ElectrophysiologyUtility.hpp.

◆ randomPointInSetAndNeighborhood()

void LifeV::ElectrophysiologyUtility::randomPointInSetAndNeighborhood ( std::vector< ID > &  container,
std::vector< ID > &  selectedPoints,
neighborList_Type neighbors 
)
inline

Select randomly a point in a given set and its neighborhood and update the set by deleting the chosen value from the set.

Parameters
containervector containig all the value
selectedPointsselected points
neighborscointainer of the neighbors

Definition at line 244 of file ElectrophysiologyUtility.hpp.

◆ randomNPointsInSet()

void LifeV::ElectrophysiologyUtility::randomNPointsInSet ( std::vector< Type > &  container,
std::vector< Type > &  selectedValue,
UInt  N 
)
inline

Select randomly N values in a given set and update the set by deleting the chosen N values from the set.

Parameters
containerSet containig all the value
selectedValuevector containg the selected values
Nnumber of values we want to select

Definition at line 266 of file ElectrophysiologyUtility.hpp.

◆ randomNPointsInSetAndNeighborhood()

void LifeV::ElectrophysiologyUtility::randomNPointsInSetAndNeighborhood ( std::vector< ID > &  container,
std::vector< ID > &  selectedValue,
std::vector< Real > &  activationTime,
Real  deltaT,
UInt  N,
Mesh &  fullMesh,
std::shared_ptr< Epetra_Comm >  Comm 
)
inline

Select randomly N values in a given set and update the set by deleting the chosen N values from the set.

Parameters
containerSet containig all the value
selectedValuevector containg the selected values
Nnumber of values we want to select
fullMeshmesh used to determine the neighborhood

Definition at line 283 of file ElectrophysiologyUtility.hpp.

◆ applyCurrentGivenSetOfPoints() [1/2]

void LifeV::ElectrophysiologyUtility::applyCurrentGivenSetOfPoints ( std::vector< Type > &  container,
std::shared_ptr< VectorEpetra appliedCurrentVector,
Real  valueAppliedCurrent 
)
inline

Apply given current to a set of points.

Parameters
containerSet containig all the globalIDs of points to which we want to apply the current
appliedCurrentVectorvector containg the current
valueAppliedCurrentvalue of the current we want to apply

Definition at line 310 of file ElectrophysiologyUtility.hpp.

◆ applyCurrentGivenSetOfPoints() [2/2]

void LifeV::ElectrophysiologyUtility::applyCurrentGivenSetOfPoints ( std::vector< Type > &  container,
std::vector< Real activationTime,
std::shared_ptr< VectorEpetra appliedCurrentVector,
std::vector< Real > &  valueAppliedCurrent,
std::vector< UInt > &  shiftVector,
Real  currentTime 
)
inline

Apply given current with a set of PMJs.

Parameters
containervector containig all the globalIDs of the PMJs to which we want to apply the current
timeActivationvector containig the activation time of the PMJs
appliedCurrentVectorvector containg the applied current
valueAppliedCurrentvector containig the apply current during the all simulation time
shiftVectorvector containig the index that refers to the value of applied current in each PMJ
currentTimecurrent time

Definition at line 332 of file ElectrophysiologyUtility.hpp.

+ Here is the caller graph for this function:

◆ importFibers()

void LifeV::ElectrophysiologyUtility::importFibers ( std::shared_ptr< VectorEpetra fiberVector,
const std::string &  fileName,
std::shared_ptr< Mesh >  localMesh,
const std::string &  filePath = "./" 
)
inline

Read fiber vector field from HDF5 file.

Parameters
fiberVectorVectorEpetra object for storing the vector field
fileNameName of the HDF5 file to read from
localMeshPointer to the mesh

Definition at line 78 of file HeartUtility.hpp.

◆ importScalarField()

void LifeV::ElectrophysiologyUtility::importScalarField ( std::shared_ptr< VectorEpetra vector,
const std::string &  fileName,
const std::string &  fieldName,
std::shared_ptr< Mesh >  localMesh 
)
inline

Read scalar field from HDF5 file.

Parameters
vectorVectorEpetra object for storing the scalar field
fileNameName of the HDF5 file to read from
fieldNameName of the scalar field in the HDF5 file
localMeshPointer to the mesh

Definition at line 109 of file HeartUtility.hpp.

◆ importVectorField()

void LifeV::ElectrophysiologyUtility::importVectorField ( std::shared_ptr< VectorEpetra vector,
const std::string &  fileName,
const std::string &  fieldName,
std::shared_ptr< Mesh >  localMesh,
const std::string &  postDir = "./" 
)
inline

Read vector field from HDF5 file.

Parameters
vectorVectorEpetra object for storing the scalar field
fileNameName of the HDF5 file to read from
fieldNameName of the vector field in the HDF5 file
localMeshPointer to the mesh

Definition at line 139 of file HeartUtility.hpp.

◆ importFibersFromTextFile()

void LifeV::ElectrophysiologyUtility::importFibersFromTextFile ( std::shared_ptr< VectorEpetra fiberVector,
std::string  fileName,
std::string  filePath,
int  format = 0 
)
inline

Read fiber field from text file.

Parameters
fiberVectorVectorEpetra object for storing the vector field
fileNameName of the HDF5 file to read from
filePathPath of the HDF5 file to read from
formatThe fibers can be in the text file in two different formats:

format 0 = fibers saved as (fx, fy, fz) in each row

format 1 = fibers saved as fx in each row for all the mesh fy in each row for all the mesh fz in each row for all the mesh

Definition at line 176 of file HeartUtility.hpp.

◆ setupFibers() [1/3]

void LifeV::ElectrophysiologyUtility::setupFibers ( VectorEpetra fiberVector,
VectorSmall< 3 > &  fiberDirection 
)
inline

Setup fiber field from unidirectional VectorSmall object.

Parameters
fiberVectorVectorEpetra object for storing the vector field
fiberDirectionDirection of fiber vectors as a VectorSmall

Definition at line 258 of file HeartUtility.hpp.

◆ setupFibers() [2/3]

void LifeV::ElectrophysiologyUtility::setupFibers ( VectorEpetra fiberVector,
std::vector< Real > &  fiberDirection 
)
inline

Setup fiber field from unidirectional std::vector object.

Parameters
fiberVectorVectorEpetra object for storing the vector field
fiberDirectionDirection of fiber vectors as a VectorSmall

Definition at line 284 of file HeartUtility.hpp.

◆ setupFibers() [3/3]

void LifeV::ElectrophysiologyUtility::setupFibers ( VectorEpetra fiberVector,
Real  fx,
Real  fy,
Real  fz 
)
inline

Setup fiber field from three real components.

Parameters
fiberVectorVectorEpetra object for storing the vector field
fxFirst component of vector
fySecond component of vector
fzThird component of vector

Definition at line 300 of file HeartUtility.hpp.

◆ setValueOnBoundary() [1/2]

void LifeV::ElectrophysiologyUtility::setValueOnBoundary ( VectorEpetra vec,
std::shared_ptr< RegionMesh< LinearTetra > >  fullMesh,
Real  value,
UInt  flag 
)
inline

On the boundary with the specified flag, set the wanted value.

Parameters
vecVectorEpetra object where we want to impose the boundary value
fullMeshPointer to the non partitioned mesh
valuevalue to set on that boundary
flagflag of the boundary

Definition at line 317 of file HeartUtility.hpp.

◆ setValueOnBoundary() [2/2]

void LifeV::ElectrophysiologyUtility::setValueOnBoundary ( VectorEpetra vec,
std::shared_ptr< RegionMesh< LinearTetra > >  fullMesh,
Real  value,
std::vector< UInt flags 
)
inline

On the boundary with the specified flags, set the wanted value.

Parameters
vecVectorEpetra object where we want to impose the boundary value
fullMeshPointer to the non partitioned mesh
valuevalue to set on that boundary
flagsflags of the boundary

Definition at line 340 of file HeartUtility.hpp.

◆ rescaleVector() [1/2]

void LifeV::ElectrophysiologyUtility::rescaleVector ( VectorEpetra vector,
Real  minValue,
Real  maxValue,
Real  scaleFactor = 1.0 
)
inline

Rescale a scalar field to be between requested bounds.

Parameters
vectorVectorEpetra object that contains the scalar field
minValueMinimum value
maxValueMaximum value
scaleFactorAdditional scaling factor (defaults to 1)

Definition at line 364 of file HeartUtility.hpp.

◆ rescaleVector() [2/2]

void LifeV::ElectrophysiologyUtility::rescaleVector ( VectorEpetra vector,
Real  scaleFactor = 1.0 
)
inline

Rescale a scalar field by a constant factor.

Parameters
vectorVectorEpetra object that contains the scalar field
scaleFactorAdditional scaling factor (defaults to 1)

Definition at line 375 of file HeartUtility.hpp.

◆ rescaleVectorOnBoundary()

void LifeV::ElectrophysiologyUtility::rescaleVectorOnBoundary ( VectorEpetra vector,
std::shared_ptr< RegionMesh< LinearTetra > >  fullMesh,
UInt  flag,
Real  scaleFactor = 1.0 
)
inline

Rescale a scalar field by a constant factor on a boundary.

Parameters
vectorVectorEpetra object that contains the scalar field
fullMeshpointer to the non partitioned mesh
flagflag of the boundary
scaleFactorAdditional scaling factor (defaults to 1)

Definition at line 389 of file HeartUtility.hpp.

◆ normalize()

void LifeV::ElectrophysiologyUtility::normalize ( VectorEpetra vector)
inline

Normalizes a vector field to unit length.

Parameters
vectorVectorEpetra object that contains the vector field

Definition at line 407 of file HeartUtility.hpp.

◆ addNoiseToFibers()

void LifeV::ElectrophysiologyUtility::addNoiseToFibers ( VectorEpetra fiberVector,
Real  magnitude = 0.01,
std::vector< bool >  component = std::vector<bool> (3, true) 
)
inline

Add random component to the fibers.

Parameters
fiberVectorVectorEpetra object for storing the vector field
fiberDirectionDirection of fiber vectors as a VectorSmall

Definition at line 445 of file HeartUtility.hpp.

+ Here is the caller graph for this function:

◆ setFibersFromFunction()

void LifeV::ElectrophysiologyUtility::setFibersFromFunction ( std::shared_ptr< VectorEpetra vector,
std::shared_ptr< Mesh >  localMesh,
function_Type  f 
)
inline

Definition at line 482 of file HeartUtility.hpp.