DFT-FE 1.1.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
dftfe::InterpolateCellWiseDataToPoints< T, memorySpace > Class Template Reference

This class forms the interface for interpolating data to an arbitrary set of points. This class is compatible with MPI, where the partitioning of cells and the points need not be compatible. As in the points need not lie within the cells assigned to the processor. More...

#include <InterpolateCellWiseDataToPoints.h>

Public Member Functions

 InterpolateCellWiseDataToPoints (const std::vector< std::shared_ptr< const dftfe::utils::Cell< 3 > > > &srcCells, std::vector< std::shared_ptr< InterpolateFromCellToLocalPoints< memorySpace > > > interpolateLocalObj, const std::vector< std::vector< double > > &targetPts, const std::vector< unsigned int > &numDofsPerElem, const unsigned int verbosity, const MPI_Comm &mpiComm)
 This constructor computes the mapping between the targetPts and srcCells. In case of incompatible partitioning, some targetPts can lie outside the cells assigned to the processor. In that case, the unmapped points are sent to other processors. Similarly it receives points from other processors and checks if any of them lies within its cells. Once all the points that lie within its cells are found, they are then passed to interpolateLocalObj, which provides the functionality to interpolate to those points.
 
void interpolateSrcDataToTargetPoints (const std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< memorySpace > > &BLASWrapperPtr, const dftfe::linearAlgebra::MultiVector< T, memorySpace > &inputVec, const unsigned int numberOfVectors, const dftfe::utils::MemoryStorage< dftfe::global_size_type, memorySpace > &mapVecToCells, dftfe::utils::MemoryStorage< T, memorySpace > &outputData, const unsigned int blockSizeOfInputData, const unsigned int blockSizeOfOutputData, const unsigned int startIndexOfInputData, bool resizeData=false)
 This function interpolates from the data to the points passed to the constructor. The function copies the nodal data to cell wise data and then interpolates to all the points that lie within that cell. Then they are copied to the output vector. At the end a mpi call is performed to gather the value of points that do not lie within processor from othe processors.
 
void interpolateSrcDataToTargetPoints (const std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< dftfe::utils::MemorySpace::HOST > > &BLASWrapperPtr, const distributedCPUVec< T > &inputVec, const unsigned int numberOfVectors, const dftfe::utils::MemoryStorage< dftfe::global_size_type, dftfe::utils::MemorySpace::HOST > &mapVecToCells, dftfe::utils::MemoryStorage< T, dftfe::utils::MemorySpace::HOST > &outputData, const unsigned int blockSizeOfInputData, const unsigned int blockSizeOfOutputData, const unsigned int startIndexOfInputData, bool resizeData=false)
 The function is same as above but set to dealii:distributed::Vector.
 

Private Member Functions

void checkIfAllPointsAreFound (const std::vector< std::vector< double > > &targetPts)
 

Private Attributes

dftfe::utils::MapPointsToCells< 3, 8 > d_mapPoints
 
std::vector< size_typed_cellPointStartIndex
 TODO check if M=8 is optimal.
 
std::vector< size_typed_cellShapeFuncStartIndex
 
const MPI_Comm d_mpiComm
 
std::shared_ptr< dftfe::utils::mpi::MPIPatternP2P< dftfe::utils::MemorySpace::HOST > > d_mpiPatternP2PPtr
 
std::shared_ptr< dftfe::utils::mpi::MPICommunicatorP2P< T, dftfe::utils::MemorySpace::HOST > > d_mpiCommP2PPtr
 
std::shared_ptr< dftfe::utils::mpi::MPIPatternP2P< memorySpace > > d_mpiP2PPtrMemSpace
 
std::unique_ptr< dftfe::utils::mpi::MPICommunicatorP2P< T, memorySpace > > d_mpiCommPtrMemSpace
 
dftfe::utils::MemoryStorage< global_size_type, memorySpace > d_mapPointToProcLocalMemSpace
 
dftfe::utils::MemoryStorage< dataTypes::number, memorySpace > d_cellLevelParentNodalMemSpace
 
size_type d_numPointsLocal
 
size_type d_numCells
 
std::vector< unsigned int > d_numDofsPerElement
 
std::vector< unsigned int > d_cumulativeDofs
 
size_type totalDofsInCells
 
std::vector< size_typed_numPointsInCell
 
std::vector< std::vector< size_type > > d_mapCellLocalToProcLocal
 
size_type d_numLocalPtsSze
 
size_type d_pointsFoundInProc
 
std::vector< global_size_typed_ghostGlobalIds
 
std::pair< global_size_type, global_size_typed_localRange
 
dftfe::utils::MemoryStorage< dataTypes::number, memorySpace > d_tempOutputMemSpace
 
std::vector< std::shared_ptr< InterpolateFromCellToLocalPoints< memorySpace > > > d_interpolateLocalObj
 
unsigned int d_verbosity
 

Detailed Description

template<typename T, dftfe::utils::MemorySpace memorySpace>
class dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >

This class forms the interface for interpolating data to an arbitrary set of points. This class is compatible with MPI, where the partitioning of cells and the points need not be compatible. As in the points need not lie within the cells assigned to the processor.

Author
Vishal Subramanian, Bikash Kanungo

Constructor & Destructor Documentation

◆ InterpolateCellWiseDataToPoints()

template<typename T, dftfe::utils::MemorySpace memorySpace>
dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::InterpolateCellWiseDataToPoints ( const std::vector< std::shared_ptr< const dftfe::utils::Cell< 3 > > > & srcCells,
std::vector< std::shared_ptr< InterpolateFromCellToLocalPoints< memorySpace > > > interpolateLocalObj,
const std::vector< std::vector< double > > & targetPts,
const std::vector< unsigned int > & numDofsPerElem,
const unsigned int verbosity,
const MPI_Comm & mpiComm )

This constructor computes the mapping between the targetPts and srcCells. In case of incompatible partitioning, some targetPts can lie outside the cells assigned to the processor. In that case, the unmapped points are sent to other processors. Similarly it receives points from other processors and checks if any of them lies within its cells. Once all the points that lie within its cells are found, they are then passed to interpolateLocalObj, which provides the functionality to interpolate to those points.

Parameters
[in]srcCellsCells that are assigned to the processor
[in]interpolateLocalObjClass that can take in a Cell and provide the functionality to interpolate to points that lie within that Cell.
[in]targetPtsThe set of points onto which the data needs to be interpolated
[in]numDofsPerElemThe number of basis function that is non-zero overlap with each cell. This is set to be a vector so that different cells can have different number of basis functions.
[in]mpiCommThe mpi communicator which has been used for the domain decomposition
Author
Vishal Subramanian, Bikash Kanungo

Member Function Documentation

◆ checkIfAllPointsAreFound()

template<typename T, dftfe::utils::MemorySpace memorySpace>
void dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::checkIfAllPointsAreFound ( const std::vector< std::vector< double > > & targetPts)
private

◆ interpolateSrcDataToTargetPoints() [1/2]

template<typename T, dftfe::utils::MemorySpace memorySpace>
void dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::interpolateSrcDataToTargetPoints ( const std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< dftfe::utils::MemorySpace::HOST > > & BLASWrapperPtr,
const distributedCPUVec< T > & inputVec,
const unsigned int numberOfVectors,
const dftfe::utils::MemoryStorage< dftfe::global_size_type, dftfe::utils::MemorySpace::HOST > & mapVecToCells,
dftfe::utils::MemoryStorage< T, dftfe::utils::MemorySpace::HOST > & outputData,
const unsigned int blockSizeOfInputData,
const unsigned int blockSizeOfOutputData,
const unsigned int startIndexOfInputData,
bool resizeData = false )

The function is same as above but set to dealii:distributed::Vector.

Parameters
[in]BLASWrapperPtrBLAS Wrapper that provides the handle to the linear algebra routines
[in]inputVecThe input data. The input data should be of size locally_owned*numberOfVectors
[in]numberOfVectorsThe number of vectors (blockSize) in the input data
[in]mapVecToCellsThe mapping that tells the nodal data to the cell wise data
[out]outputDataThe output where the nodal data is interpolated to the points. The memory layout of outputData is as follows - the memory is stored in the same order as the target points. In addition to the target points, there are ghost points which are points that lie within its cells but lie in cells assigned to a different processor.
[in]resizeDataThe output data should be of size (locally owned + ghost)*numberOfVectors If the flag resizeData is set to true, outputData is resized appropriately.
Author
Vishal Subramanian, Bikash Kanungo

◆ interpolateSrcDataToTargetPoints() [2/2]

template<typename T, dftfe::utils::MemorySpace memorySpace>
void dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::interpolateSrcDataToTargetPoints ( const std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< memorySpace > > & BLASWrapperPtr,
const dftfe::linearAlgebra::MultiVector< T, memorySpace > & inputVec,
const unsigned int numberOfVectors,
const dftfe::utils::MemoryStorage< dftfe::global_size_type, memorySpace > & mapVecToCells,
dftfe::utils::MemoryStorage< T, memorySpace > & outputData,
const unsigned int blockSizeOfInputData,
const unsigned int blockSizeOfOutputData,
const unsigned int startIndexOfInputData,
bool resizeData = false )

This function interpolates from the data to the points passed to the constructor. The function copies the nodal data to cell wise data and then interpolates to all the points that lie within that cell. Then they are copied to the output vector. At the end a mpi call is performed to gather the value of points that do not lie within processor from othe processors.

Parameters
[in]BLASWrapperPtrBLAS Wrapper that provides the handle to the linear algebra routines
[in]inputVecThe input data. The input data should be of size locally_owned*numberOfVectors
[in]numberOfVectorsThe number of vectors (blockSize) in the input data
[in]mapVecToCellsThe mapping that tells the nodal data to the cell wise data
[out]outputDataThe output where the nodal data is interpolated to the points. The memory layout of outputData is as follows - the memory is stored in the same order as the target points. In addition to the target points, there are ghost points which are points that lie within its cells but lie in cells assigned to a different processor.
[in]resizeDataThe output data should be of size (locally owned + ghost)*numberOfVectors If the flag resizeData is set to true, outputData is resized appropriately.
Author
Vishal Subramanian, Bikash Kanungo

Member Data Documentation

◆ d_cellLevelParentNodalMemSpace

template<typename T, dftfe::utils::MemorySpace memorySpace>
dftfe::utils::MemoryStorage<dataTypes::number, memorySpace> dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_cellLevelParentNodalMemSpace
private

◆ d_cellPointStartIndex

template<typename T, dftfe::utils::MemorySpace memorySpace>
std::vector<size_type> dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_cellPointStartIndex
private

TODO check if M=8 is optimal.

◆ d_cellShapeFuncStartIndex

template<typename T, dftfe::utils::MemorySpace memorySpace>
std::vector<size_type> dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_cellShapeFuncStartIndex
private

◆ d_cumulativeDofs

template<typename T, dftfe::utils::MemorySpace memorySpace>
std::vector<unsigned int> dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_cumulativeDofs
private

◆ d_ghostGlobalIds

template<typename T, dftfe::utils::MemorySpace memorySpace>
std::vector<global_size_type> dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_ghostGlobalIds
private

◆ d_interpolateLocalObj

template<typename T, dftfe::utils::MemorySpace memorySpace>
std::vector<std::shared_ptr<InterpolateFromCellToLocalPoints<memorySpace> > > dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_interpolateLocalObj
private

◆ d_localRange

template<typename T, dftfe::utils::MemorySpace memorySpace>
std::pair<global_size_type, global_size_type> dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_localRange
private

◆ d_mapCellLocalToProcLocal

template<typename T, dftfe::utils::MemorySpace memorySpace>
std::vector<std::vector<size_type> > dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_mapCellLocalToProcLocal
private

◆ d_mapPoints

template<typename T, dftfe::utils::MemorySpace memorySpace>
dftfe::utils::MapPointsToCells<3, 8> dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_mapPoints
private

◆ d_mapPointToProcLocalMemSpace

template<typename T, dftfe::utils::MemorySpace memorySpace>
dftfe::utils::MemoryStorage<global_size_type, memorySpace> dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_mapPointToProcLocalMemSpace
private

◆ d_mpiComm

template<typename T, dftfe::utils::MemorySpace memorySpace>
const MPI_Comm dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_mpiComm
private

◆ d_mpiCommP2PPtr

template<typename T, dftfe::utils::MemorySpace memorySpace>
std::shared_ptr< dftfe::utils::mpi::MPICommunicatorP2P<T, dftfe::utils::MemorySpace::HOST> > dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_mpiCommP2PPtr
private

◆ d_mpiCommPtrMemSpace

template<typename T, dftfe::utils::MemorySpace memorySpace>
std::unique_ptr<dftfe::utils::mpi::MPICommunicatorP2P<T, memorySpace> > dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_mpiCommPtrMemSpace
private

◆ d_mpiP2PPtrMemSpace

template<typename T, dftfe::utils::MemorySpace memorySpace>
std::shared_ptr<dftfe::utils::mpi::MPIPatternP2P<memorySpace> > dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_mpiP2PPtrMemSpace
private

◆ d_mpiPatternP2PPtr

template<typename T, dftfe::utils::MemorySpace memorySpace>
std::shared_ptr< dftfe::utils::mpi::MPIPatternP2P<dftfe::utils::MemorySpace::HOST> > dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_mpiPatternP2PPtr
private

◆ d_numCells

template<typename T, dftfe::utils::MemorySpace memorySpace>
size_type dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_numCells
private

◆ d_numDofsPerElement

template<typename T, dftfe::utils::MemorySpace memorySpace>
std::vector<unsigned int> dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_numDofsPerElement
private

◆ d_numLocalPtsSze

template<typename T, dftfe::utils::MemorySpace memorySpace>
size_type dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_numLocalPtsSze
private

◆ d_numPointsInCell

template<typename T, dftfe::utils::MemorySpace memorySpace>
std::vector<size_type> dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_numPointsInCell
private

◆ d_numPointsLocal

template<typename T, dftfe::utils::MemorySpace memorySpace>
size_type dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_numPointsLocal
private

◆ d_pointsFoundInProc

template<typename T, dftfe::utils::MemorySpace memorySpace>
size_type dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_pointsFoundInProc
private

◆ d_tempOutputMemSpace

template<typename T, dftfe::utils::MemorySpace memorySpace>
dftfe::utils::MemoryStorage<dataTypes::number, memorySpace> dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_tempOutputMemSpace
private

◆ d_verbosity

template<typename T, dftfe::utils::MemorySpace memorySpace>
unsigned int dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::d_verbosity
private

◆ totalDofsInCells

template<typename T, dftfe::utils::MemorySpace memorySpace>
size_type dftfe::InterpolateCellWiseDataToPoints< T, memorySpace >::totalDofsInCells
private

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