DFT-FE 1.1.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
dftfe::vectorTools Namespace Reference

Contains generic utils functions related to custom partitioned flattened dealii vector. More...

Functions

void createParallelConstraintMatrixFromSerial (const dealii::Triangulation< 3, 3 > &serTria, const dealii::DoFHandler< 3 > &dofHandlerPar, const MPI_Comm &mpi_comm_parent, const MPI_Comm &mpi_comm_domain, const std::vector< std::vector< double > > &domainBoundingVectors, dealii::AffineConstraints< double > &periodicHangingConstraints, dealii::AffineConstraints< double > &onlyHangingConstraints, const int verbosity, const bool periodicX, const bool periodicY, const bool periodicZ)
 Create constraint matrix using serial mesh. Temporary fix for a bug (Issue #7053) in deal.ii until it is resolved.
 
template<typename T>
void createDealiiVector (const std::shared_ptr< const dealii::Utilities::MPI::Partitioner > &partitioner, const unsigned int blockSize, distributedCPUVec< T > &flattenedArray)
 Creates a custom partitioned flattened dealii vector. stores multiple components asociated with a node sequentially.
 
void computeCellLocalIndexSetMap (const std::shared_ptr< const utils::mpi::MPIPatternP2P< dftfe::utils::MemorySpace::HOST > > &partitioner, const dealii::MatrixFree< 3, double > &matrix_free_data, const unsigned int mfDofHandlerIndex, const unsigned int blockSize, std::vector< std::vector< dealii::types::global_dof_index > > &flattenedArrayMacroCellLocalProcIndexId, std::vector< std::vector< dealii::types::global_dof_index > > &flattenedArrayCellLocalProcIndexId)
 Creates a cell local index set map for flattened array.
 
void computeCellLocalIndexSetMap (const std::shared_ptr< const utils::mpi::MPIPatternP2P< dftfe::utils::MemorySpace::HOST > > &partitioner, const dealii::MatrixFree< 3, double > &matrix_free_data, const unsigned int mfDofHandlerIndex, const unsigned int blockSize, std::vector< dealii::types::global_dof_index > &flattenedArrayMacroCellLocalProcIndexId, std::vector< unsigned int > &normalCellIdToMacroCellIdMap, std::vector< unsigned int > &macroCellIdToNormalCellIdMap, std::vector< dealii::types::global_dof_index > &flattenedArrayCellLocalProcIndexId)
 Creates a cell local index set map for flattened array.
 
void computeCellLocalIndexSetMap (const std::shared_ptr< const utils::mpi::MPIPatternP2P< dftfe::utils::MemorySpace::HOST > > &partitioner, const dealii::MatrixFree< 3, double > &matrix_free_data, const unsigned int mfDofHandlerIndex, const unsigned int blockSize, std::vector< dealii::types::global_dof_index > &flattenedArrayCellLocalProcIndexId)
 Creates a cell local index set map for flattened array.
 
void copyFlattenedSTLVecToSingleCompVec (const double *flattenedArray, const unsigned int totalNumberComponents, const unsigned int localVectorSize, const std::pair< unsigned int, unsigned int > componentIndexRange, std::vector< distributedCPUVec< double > > &componentVectors)
 Copies a single field component from a flattenedArray STL vector containing multiple component fields to a single field parallel distributed vector.
 
void copyFlattenedDealiiVecToSingleCompVec (const distributedCPUVec< double > &flattenedArray, const unsigned int totalNumberComponents, const std::pair< unsigned int, unsigned int > componentIndexRange, std::vector< distributedCPUVec< double > > &componentVectors, const bool isFlattenedDealiiGhostValuesUpdated=false)
 Copies a single field component from a flattenedArray parallel distributed vector containing multiple component fields to a single field parallel distributed vector.
 
void copySingleCompVecToFlattenedDealiiVec (distributedCPUVec< double > &flattenedArray, const unsigned int totalNumberComponents, const std::pair< unsigned int, unsigned int > componentIndexRange, const std::vector< distributedCPUVec< double > > &componentVectors)
 Copies to a flattenedArray parallel distributed vector containing multiple component fields from a single field parallel distributed vector.
 
void copySingleCompVecToFlattenedSTLVec (std::vector< double > &flattenedArray, const unsigned int totalNumberComponents, const std::pair< unsigned int, unsigned int > componentIndexRange, const std::vector< distributedCPUVec< double > > &componentVectors)
 Copies to a flattenedArray stl vector containing multiple component fields from a single field parallel distributed vector.
 
std::pair< dealii::Point< 3 >, dealii::Point< 3 > > createBoundingBoxTriaLocallyOwned (const dealii::DoFHandler< 3 > &dofHandler)
 
void classifyInteriorSurfaceNodesInCell (const dealii::MatrixFree< 3, double > &matrix_free_data, const unsigned int mfDofHandlerIndex, std::vector< unsigned int > &nodesPerCellClassificationMap)
 
void classifyInteriorSurfaceNodesInGlobalArray (const dealii::MatrixFree< 3, double > &matrix_free_data, const unsigned int mfDofHandlerIndex, const dealii::AffineConstraints< double > &constraintMatrix, std::vector< unsigned int > &nodesPerCellClassificationMap, std::vector< unsigned int > &globalArrayClassificationMap)
 

Detailed Description

Contains generic utils functions related to custom partitioned flattened dealii vector.

Author
Phani Motamarri, Sambit Das

Function Documentation

◆ classifyInteriorSurfaceNodesInCell()

void dftfe::vectorTools::classifyInteriorSurfaceNodesInCell ( const dealii::MatrixFree< 3, double > & matrix_free_data,
const unsigned int mfDofHandlerIndex,
std::vector< unsigned int > & nodesPerCellClassificationMap )

◆ classifyInteriorSurfaceNodesInGlobalArray()

void dftfe::vectorTools::classifyInteriorSurfaceNodesInGlobalArray ( const dealii::MatrixFree< 3, double > & matrix_free_data,
const unsigned int mfDofHandlerIndex,
const dealii::AffineConstraints< double > & constraintMatrix,
std::vector< unsigned int > & nodesPerCellClassificationMap,
std::vector< unsigned int > & globalArrayClassificationMap )

◆ computeCellLocalIndexSetMap() [1/3]

void dftfe::vectorTools::computeCellLocalIndexSetMap ( const std::shared_ptr< const utils::mpi::MPIPatternP2P< dftfe::utils::MemorySpace::HOST > > & partitioner,
const dealii::MatrixFree< 3, double > & matrix_free_data,
const unsigned int mfDofHandlerIndex,
const unsigned int blockSize,
std::vector< dealii::types::global_dof_index > & flattenedArrayCellLocalProcIndexId )

Creates a cell local index set map for flattened array.

Parameters
partitionerassociated with the flattened array
matrix_free_dataobject pointer associated with the matrix free data structure
blockSizenumber of components associated with each node
Returns
flattenedArrayMacroCellLocalProcIndexId macrocell's subcell local proc index map
flattenedArrayCellLocalProcIndexId cell local proc index map

◆ computeCellLocalIndexSetMap() [2/3]

void dftfe::vectorTools::computeCellLocalIndexSetMap ( const std::shared_ptr< const utils::mpi::MPIPatternP2P< dftfe::utils::MemorySpace::HOST > > & partitioner,
const dealii::MatrixFree< 3, double > & matrix_free_data,
const unsigned int mfDofHandlerIndex,
const unsigned int blockSize,
std::vector< dealii::types::global_dof_index > & flattenedArrayMacroCellLocalProcIndexId,
std::vector< unsigned int > & normalCellIdToMacroCellIdMap,
std::vector< unsigned int > & macroCellIdToNormalCellIdMap,
std::vector< dealii::types::global_dof_index > & flattenedArrayCellLocalProcIndexId )

Creates a cell local index set map for flattened array.

Parameters
partitionerassociated with the flattened array
matrix_free_dataobject pointer associated with the matrix free data structure
blockSizenumber of components associated with each node
Returns
flattenedArrayMacroCellLocalProcIndexId macrocell's subcell local proc index map
flattenedArrayCellLocalProcIndexId cell local proc index map

◆ computeCellLocalIndexSetMap() [3/3]

void dftfe::vectorTools::computeCellLocalIndexSetMap ( const std::shared_ptr< const utils::mpi::MPIPatternP2P< dftfe::utils::MemorySpace::HOST > > & partitioner,
const dealii::MatrixFree< 3, double > & matrix_free_data,
const unsigned int mfDofHandlerIndex,
const unsigned int blockSize,
std::vector< std::vector< dealii::types::global_dof_index > > & flattenedArrayMacroCellLocalProcIndexId,
std::vector< std::vector< dealii::types::global_dof_index > > & flattenedArrayCellLocalProcIndexId )

Creates a cell local index set map for flattened array.

Parameters
partitionerassociated with the flattened array
matrix_free_dataobject pointer associated with the matrix free data structure
blockSizenumber of components associated with each node
Returns
flattenedArrayMacroCellLocalProcIndexId macrocell's subcell local proc index map
flattenedArrayCellLocalProcIndexId cell local proc index map

◆ copyFlattenedDealiiVecToSingleCompVec()

void dftfe::vectorTools::copyFlattenedDealiiVecToSingleCompVec ( const distributedCPUVec< double > & flattenedArray,
const unsigned int totalNumberComponents,
const std::pair< unsigned int, unsigned int > componentIndexRange,
std::vector< distributedCPUVec< double > > & componentVectors,
const bool isFlattenedDealiiGhostValuesUpdated = false )

Copies a single field component from a flattenedArray parallel distributed vector containing multiple component fields to a single field parallel distributed vector.

Parameters
[in]flattenedArrayflattened parallel distributed vector with multiple component fields
[in]totalNumberComponentstotal number of component fiels in flattenedArray
[in]componentIndexRangedesired range field components [componentIndexRange.first,componentIndexRange.second)
[out]componentVectorsvector of parallel distributed vectors with fields corresponding to componentIndexRange. componentVectors is expected to be of the size componentIndexRange.second-componentIndexRange.first. Further, each entry of componentVectors is assumed to be already initialized with the same single component partitioner used in the creation of the flattenedArray partitioner.
[in]isFlattenedDealiiGhostValuesUpdateddefault is false. Use true for optimization if update ghost values has already been called in the flattened dealii vec.

◆ copyFlattenedSTLVecToSingleCompVec()

void dftfe::vectorTools::copyFlattenedSTLVecToSingleCompVec ( const double * flattenedArray,
const unsigned int totalNumberComponents,
const unsigned int localVectorSize,
const std::pair< unsigned int, unsigned int > componentIndexRange,
std::vector< distributedCPUVec< double > > & componentVectors )

Copies a single field component from a flattenedArray STL vector containing multiple component fields to a single field parallel distributed vector.

Parameters
[in]flattenedArrayflattened STL vector with multiple component fields
[in]totalNumberComponentstotal number of component fiels in flattenedArray
[in]componentIndexRangedesired range field components [componentIndexRange.first,componentIndexRange.second)
[out]componentVectorsvector of parallel distributed vectors with fields corresponding to componentIndexRange. componentVectors is expected to be of the size componentIndexRange.second-componentIndexRange.first. Further, each entry of componentVectors is assumed to be already initialized with the same single component partitioner used in the creation of the flattenedArray partitioner.

◆ copySingleCompVecToFlattenedDealiiVec()

void dftfe::vectorTools::copySingleCompVecToFlattenedDealiiVec ( distributedCPUVec< double > & flattenedArray,
const unsigned int totalNumberComponents,
const std::pair< unsigned int, unsigned int > componentIndexRange,
const std::vector< distributedCPUVec< double > > & componentVectors )

Copies to a flattenedArray parallel distributed vector containing multiple component fields from a single field parallel distributed vector.

Parameters
[out]flattenedArrayflattened parallel distributed vector with multiple component fields
[in]totalNumberComponentstotal number of component fiels in flattenedArray
[in]componentIndexRangedesired range field components [componentIndexRange.first,componentIndexRange.second)
[in]componentVectorsvector of parallel distributed vectors with fields corresponding to componentIndexRange. componentVectors is expected to be of the size componentIndexRange.second-componentIndexRange.first. Further, each entry of componentVectors is assumed to be already initialized with the same single component partitioner used in the creation of the flattenedArray partitioner.

◆ copySingleCompVecToFlattenedSTLVec()

void dftfe::vectorTools::copySingleCompVecToFlattenedSTLVec ( std::vector< double > & flattenedArray,
const unsigned int totalNumberComponents,
const std::pair< unsigned int, unsigned int > componentIndexRange,
const std::vector< distributedCPUVec< double > > & componentVectors )

Copies to a flattenedArray stl vector containing multiple component fields from a single field parallel distributed vector.

Parameters
[out]flattenedArrayflattened stl vector with multiple component fields
[in]totalNumberComponentstotal number of component fiels in flattenedArray
[in]componentIndexRangedesired range field components [componentIndexRange.first,componentIndexRange.second)
[in]componentVectorsvector of parallel distributed vectors with fields corresponding to componentIndexRange. componentVectors is expected to be of the size componentIndexRange.second-componentIndexRange.first. Further, each entry of componentVectors is assumed to be already initialized with the same single component partitioner used in the creation of the flattenedArray partitioner.

◆ createBoundingBoxTriaLocallyOwned()

std::pair< dealii::Point< 3 >, dealii::Point< 3 > > dftfe::vectorTools::createBoundingBoxTriaLocallyOwned ( const dealii::DoFHandler< 3 > & dofHandler)

◆ createDealiiVector()

template<typename T>
void dftfe::vectorTools::createDealiiVector ( const std::shared_ptr< const dealii::Utilities::MPI::Partitioner > & partitioner,
const unsigned int blockSize,
distributedCPUVec< T > & flattenedArray )

Creates a custom partitioned flattened dealii vector. stores multiple components asociated with a node sequentially.

Parameters
partitionerassociated with single component vector
blockSizenumber of components associated with each node
Returns
flattenedArray custom partitioned dealii vector

◆ createParallelConstraintMatrixFromSerial()

void dftfe::vectorTools::createParallelConstraintMatrixFromSerial ( const dealii::Triangulation< 3, 3 > & serTria,
const dealii::DoFHandler< 3 > & dofHandlerPar,
const MPI_Comm & mpi_comm_parent,
const MPI_Comm & mpi_comm_domain,
const std::vector< std::vector< double > > & domainBoundingVectors,
dealii::AffineConstraints< double > & periodicHangingConstraints,
dealii::AffineConstraints< double > & onlyHangingConstraints,
const int verbosity,
const bool periodicX,
const bool periodicY,
const bool periodicZ )

Create constraint matrix using serial mesh. Temporary fix for a bug (Issue #7053) in deal.ii until it is resolved.

Parameters
[in]serialTriangulation which must be exactly same as the parallel triangulation associated with dofHandlerPar
[in]parallelDofHandler
[out]periodichanging constraints.
[out]onlyhanging constraints