DFT-FE 1.3.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
FEBasisOperations.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (c) 2017-2025 The Regents of the University of Michigan and DFT-FE
4// authors.
5//
6// This file is part of the DFT-FE code.
7//
8// The DFT-FE code is free software; you can use it, redistribute
9// it, and/or modify it under the terms of the GNU Lesser General
10// Public License as published by the Free Software Foundation; either
11// version 2.1 of the License, or (at your option) any later version.
12// The full text of the license can be found in the file LICENSE at
13// the top level of the DFT-FE distribution.
14//
15// ---------------------------------------------------------------------
16//
17
18#ifndef dftfeFEBasisOperations_h
19#define dftfeFEBasisOperations_h
20
21#include <MultiVector.h>
22#include <headers.h>
24#include <DeviceTypeConfig.h>
25#include <BLASWrapper.h>
26
27namespace dftfe
28{
29 namespace basis
30 {
32 {
34
35 update_values = 0x0001,
36
38
40
42
44
45 update_jxw = 0x0020,
46 };
47
48 inline UpdateFlags
49 operator|(const UpdateFlags f1, const UpdateFlags f2)
50 {
51 return static_cast<UpdateFlags>(static_cast<dftfe::uInt>(f1) |
52 static_cast<dftfe::uInt>(f2));
53 }
54
55
56
57 inline UpdateFlags &
59 {
60 f1 = f1 | f2;
61 return f1;
62 }
63
64
65 inline UpdateFlags
66 operator&(const UpdateFlags f1, const UpdateFlags f2)
67 {
68 return static_cast<UpdateFlags>(static_cast<dftfe::uInt>(f1) &
69 static_cast<dftfe::uInt>(f2));
70 }
71
72
73 inline UpdateFlags &
75 {
76 f1 = f1 & f2;
77 return f1;
78 }
79
80
81 template <typename ValueTypeBasisCoeff,
82 typename ValueTypeBasisData,
83 dftfe::utils::MemorySpace memorySpace>
85 {
86 protected:
97 std::shared_ptr<dftfe::linearAlgebra::BLASWrapper<memorySpace>>
99
100 public:
101 /**
102 * @brief Constructor
103 */
106 BLASWrapperPtr);
107
108
109 /**
110 * @brief Default Destructor
111 */
113
114 /**
115 * @brief Clears the FEBasisOperations internal storage.
116 */
117 void
119
120 /**
121 * @brief fills required data structures for the given dofHandlerID
122 * @param[in] matrixFreeData MatrixFree object.
123 * @param[in] constraintsVector std::vector of AffineConstraints, should
124 * be the same vector which was passed for the construction of the given
125 * MatrixFree object.
126 * @param[in] dofHandlerID dofHandler index to be used for getting data
127 * from the MatrixFree object.
128 * @param[in] quadratureID std::vector of quadratureIDs to be used, should
129 * be the same IDs which were used during the construction of the given
130 * MatrixFree object.
131 */
132 void
133 init(dealii::MatrixFree<3, ValueTypeBasisData> &matrixFreeData,
134 std::vector<const dealii::AffineConstraints<ValueTypeBasisData> *>
135 &constraintsVector,
136 const dftfe::uInt &dofHandlerID,
137 const std::vector<dftfe::uInt> &quadratureID,
138 const std::vector<UpdateFlags> updateFlags);
139
140 /**
141 * @brief fills required data structures from another FEBasisOperations object
142 * @param[in] basisOperationsSrc Source FEBasisOperations object.
143 */
144 template <dftfe::utils::MemorySpace memorySpaceSrc>
145 void
146 init(const FEBasisOperations<ValueTypeBasisCoeff,
147 ValueTypeBasisData,
148 memorySpaceSrc> &basisOperationsSrc);
149
150 /**
151 * @brief sets internal variables and optionally resizes internal temp storage for interpolation operations
152 * @param[in] vecBlockSize block size to used for operations on vectors,
153 * this has to be set to the exact value before any such operations are
154 * called.
155 * @param[in] cellBlockSize block size to used for cells, this has to be
156 * set to a value greater than or equal to the required value before any
157 * such operations are called
158 * @param[in] quadratureID Quadrature index to be used.
159 * @param[in] isResizeTempStorage whether to resize internal tempstorage.
160 */
161 void
162 reinit(const dftfe::uInt &vecBlockSize,
163 const dftfe::uInt &cellBlockSize,
164 const dftfe::uInt &quadratureID,
165 const bool isResizeTempStorageForInerpolation = true,
166 const bool isResizeTempStorageForCellMatrices = false,
167 const bool isResizeTempStorageForIntegralEvaluations = false);
168
172
173 // private:
174
175
176 /**
177 * @brief Initializes indexset maps from process level indices to cell level indices for a single vector, also initializes cell index to cellid map.
178 */
179 void
181
182 /**
183 * @brief Initializes indexset maps from process level indices to cell level indices for multivectors.
184 */
185 void
187
188 /**
189 * @brief Initializes the constraintMatrixInfo object.
190 */
191 void
193
194 /**
195 * @brief Reinitializes the constraintMatrixInfo object.
196 */
197 void
199 std::vector<const dealii::AffineConstraints<ValueTypeBasisData> *>
200 &constraintsVector);
201
202 /**
203 * @brief Constructs the MPIPatternP2P object.
204 */
205 void
207
208 /**
209 * @brief Fill the shape function data and jacobian data in the ValueTypeBasisCoeff datatype.
210 */
211 void
213
214 /**
215 * @brief Fill the shape function data and jacobian data in the ValueTypeBasisData datatype.
216 */
217 void
219
220
221 /**
222 * @brief Computes the cell-level stiffness matrix.
223 */
224 void
226 const dftfe::uInt cellsBlockSize,
227 const bool basisType = false,
228 const bool ceoffType = true);
229
230 void
232 const dftfe::uInt cellsBlockSize,
233 const bool basisType = false,
234 const bool ceoffType = true);
235
236 void
238 const std::pair<dftfe::uInt, dftfe::uInt> cellRangeTotal,
241 &weightedCellMassMatrix) const;
242
243 void
245 const std::vector<dftfe::uInt> &cellIndices,
246 const dftfe::uInt &noKpoints,
247 const dftfe::uInt &noOfVectors,
248 const dftfe::uInt &totalElements,
249 const dftfe::uInt &iElemStart,
251 &scalarField,
253 &scalarFieldTimesShapeFunctionIntegral) const;
254
255 void
257 const std::vector<dftfe::uInt> &cellIndices,
258 const dftfe::uInt &noKpoints,
259 const dftfe::uInt &noOfVectors,
260 const dftfe::uInt &totalElements,
261 const dftfe::uInt &iElemStart,
263 &scalarField,
265 &scalarFieldTimesGradientShapeFunctionIntegral) const;
266
267 void
269 const std::vector<dftfe::uInt> &cellIndices,
270 const dftfe::uInt &noKpoints,
271 const dftfe::uInt &noOfVectors,
272 const dftfe::uInt &totalElements,
273 const dftfe::uInt &iElemStart,
275 &vectorField,
277 &vectorFieldDyadicGradientShapeFunctionIntegral) const;
278
279 void
281 const std::pair<dftfe::uInt, dftfe::uInt> cellRangeTotal,
284 &weightedCellNjGradNiMatrix) const;
285
286 void
288 const std::pair<dftfe::uInt, dftfe::uInt> cellRangeTotal,
291 &weightedCellNjGradNiPlusNiGradNjMatrix) const;
292
293 void
295 const std::pair<dftfe::uInt, dftfe::uInt> cellRangeTotal,
298 &weightedCellNjGradNiPlusNiGradNjMatrix) const;
299
300 void
302 const std::pair<dftfe::uInt, dftfe::uInt> cellRangeTotal,
305 &weightedCellStiffnessMatrix) const;
306
307 void
308 computeInverseSqrtMassVector(const bool basisType = true,
309 const bool ceoffType = false);
310
311 /**
312 * @brief Computes the stiffness matrix
313 * \grad Ni . \grad Ni.
314 */
315 void
316 computeStiffnessVector(const bool basisType = true,
317 const bool ceoffType = false);
318
319 /**
320 * @brief Resizes the internal temp storage to be sufficient for the vector and cell block sizes provided in reinit.
321 */
322 void
323 resizeTempStorage(const bool isResizeTempStorageForInerpolation,
324 const bool isResizeTempStorageForCellMatrices,
325 const bool isResizeTempStorageForIntegralEvaluations);
326
327 /**
328 * @brief Number of quadrature points per cell for the quadratureID set in reinit.
329 */
332
333 /**
334 * @brief Number of vectors set in reinit.
335 */
337 nVectors() const;
338 /**
339 * @brief Number of DoFs per cell for the dofHandlerID set in init.
340 */
343
344 /**
345 * @brief Number of locally owned cells on the current processor.
346 */
348 nCells() const;
349
350 /**
351 * @brief Number of DoFs on the current processor, locally owned + ghosts.
352 */
355
356 /**
357 * @brief Number of locally owned DoFs on the current processor.
358 */
360 nOwnedDofs() const;
361
362 /**
363 * @brief Shape function values at quadrature points.
364 * @param[in] transpose if false the the data is indexed as [iQuad *
365 * d_nDofsPerCell + iNode] and if true it is indexed as [iNode *
366 * d_nQuadsPerCell + iQuad].
367 */
369 shapeFunctionData(bool transpose = false) const;
370
371 /**
372 * @brief Shape function gradient values at quadrature points.
373 * @param[in] transpose if false the the data is indexed as [iDim *
374 * d_nQuadsPerCell * d_nDofsPerCell + iQuad * d_nDofsPerCell + iNode] and
375 * if true it is indexed as [iDim * d_nQuadsPerCell * d_nDofsPerCell +
376 * iNode * d_nQuadsPerCell + iQuad].
377 */
379 shapeFunctionGradientData(bool transpose = false) const;
380
381 /**
382 * @brief Inverse Jacobian matrices, for cartesian cells returns the
383 * diagonal elements of the inverse Jacobian matrices for each cell, for
384 * affine cells returns the 3x3 inverse Jacobians for each cell otherwise
385 * returns the 3x3 inverse Jacobians at each quad point for each cell.
386 */
389
390 /**
391 * @brief determinant of Jacobian times the quadrature weight at each
392 * quad point for each cell.
393 */
395 JxW() const;
396
397 /**
398 * @brief quad point coordinates for each cell.
399 */
400 const dftfe::utils::MemoryStorage<ValueTypeBasisData,
402 quadPoints() const;
403
404 /**
405 * @brief quad point coordinates for each cell.
406 */
407 const dftfe::utils::MemoryStorage<ValueTypeBasisData,
410
411 /**
412 * @brief Shape function values at quadrature points in ValueTypeBasisData.
413 * @param[in] transpose if false the the data is indexed as [iQuad *
414 * d_nDofsPerCell + iNode] and if true it is indexed as [iNode *
415 * d_nQuadsPerCell + iQuad].
416 */
417 const auto &
418 shapeFunctionBasisData(bool transpose = false) const
419 {
420 if constexpr (std::is_same<ValueTypeBasisCoeff,
421 ValueTypeBasisData>::value)
422 {
423 return transpose ?
426 }
427 else
428 {
429 return transpose ?
431 ->second :
433 }
434 }
435 /**
436 * @brief Shape function gradient values at quadrature points in ValueTypeBasisData.
437 * @param[in] transpose if false the the data is indexed as [iDim *
438 * d_nQuadsPerCell * d_nDofsPerCell + iQuad * d_nDofsPerCell + iNode] and
439 * if true it is indexed as [iDim * d_nQuadsPerCell * d_nDofsPerCell +
440 * iNode * d_nQuadsPerCell + iQuad].
441 */
442 const auto &
443 shapeFunctionGradientBasisData(bool transpose = false) const
444 {
445 if constexpr (std::is_same<ValueTypeBasisCoeff,
446 ValueTypeBasisData>::value)
447 {
448 return transpose ?
450 ->second :
452 }
453 else
454 {
455 return transpose ?
457 .find(d_quadratureID)
458 ->second :
460 ->second;
461 }
462 }
463
464 /**
465 * @brief Inverse Jacobian matrices in ValueTypeBasisData, for cartesian cells returns the
466 * diagonal elements of the inverse Jacobian matrices for each cell, for
467 * affine cells returns the 3x3 inverse Jacobians for each cell otherwise
468 * returns the 3x3 inverse Jacobians at each quad point for each cell.
469 */
470 const auto &
472 {
473 if constexpr (std::is_same<ValueTypeBasisCoeff,
474 ValueTypeBasisData>::value)
475 {
478 ->second;
479 }
480 else
481 {
484 ->second;
485 }
486 }
487
488 /**
489 * @brief determinant of Jacobian times the quadrature weight in ValueTypeBasisData at each
490 * quad point for each cell.
491 */
492 const auto &
494 {
495 if constexpr (std::is_same<ValueTypeBasisCoeff,
496 ValueTypeBasisData>::value)
497 {
498 return d_JxWData.find(d_quadratureID)->second;
499 }
500 else
501 {
502 return d_JxWBasisData.find(d_quadratureID)->second;
503 }
504 }
505
506 /**
507 * @brief Cell level stiffness matrix in ValueTypeBasisCoeff
508 */
509 const auto &
511 {
512 if constexpr (std::is_same<ValueTypeBasisCoeff,
513 ValueTypeBasisData>::value)
514 {
516 }
517 else
518 {
520 }
521 }
522
523
524 /**
525 * @brief Cell level stiffness matrix in ValueTypeBasisData
526 */
529
530
531 /**
532 * @brief Cell level mass matrix in ValueTypeBasisCoeff
533 */
534 const auto &
536 {
537 if constexpr (std::is_same<ValueTypeBasisCoeff,
538 ValueTypeBasisData>::value)
539 {
541 }
542 else
543 {
545 }
546 }
547
548
549 /**
550 * @brief Cell level mass matrix in ValueTypeBasisData
551 */
554
555
556 /**
557 * @brief Cell level inverse sqrt diagonal mass matrix in ValueTypeBasisCoeff
558 */
559 const auto &
561 {
562 if constexpr (std::is_same<ValueTypeBasisCoeff,
563 ValueTypeBasisData>::value)
564 {
566 }
567 else
568 {
570 }
571 }
572
573 /**
574 * @brief Cell level inverse diagonal mass matrix in ValueTypeBasisCoeff
575 */
576 const auto &
578 {
579 if constexpr (std::is_same<ValueTypeBasisCoeff,
580 ValueTypeBasisData>::value)
581 {
583 }
584 else
585 {
587 }
588 }
589
590 /**
591 * @brief Cell level sqrt diagonal mass matrix in ValueTypeBasisCoeff
592 */
593 const auto &
595 {
596 if constexpr (std::is_same<ValueTypeBasisCoeff,
597 ValueTypeBasisData>::value)
598 {
600 }
601 else
602 {
604 }
605 }
606
607 /**
608 * @brief Cell level diagonal mass matrix in ValueTypeBasisCoeff
609 */
610 const auto &
612 {
613 if constexpr (std::is_same<ValueTypeBasisCoeff,
614 ValueTypeBasisData>::value)
615 {
617 }
618 else
619 {
621 }
622 }
623
624
625 /**
626 * @brief Inverse sqrt diagonal mass matrix in ValueTypeBasisCoeff
627 */
628 const auto &
630 {
631 if constexpr (std::is_same<ValueTypeBasisCoeff,
632 ValueTypeBasisData>::value)
633 {
635 }
636 else
637 {
639 }
640 }
641
642
643
644 /**
645 * @brief Inverse sqrt diagonal mass matrix in ValueTypeBasisCoeff
646 */
647 const auto &
649 {
650 if constexpr (std::is_same<ValueTypeBasisCoeff,
651 ValueTypeBasisData>::value)
652 {
654 }
655 else
656 {
658 }
659 }
660
661
662 /**
663 * @brief sqrt diagonal mass matrix in ValueTypeBasisCoeff
664 */
665 const auto &
667 {
668 if constexpr (std::is_same<ValueTypeBasisCoeff,
669 ValueTypeBasisData>::value)
670 {
672 }
673 else
674 {
676 }
677 }
678
679 /**
680 * @brief diagonal mass matrix in ValueTypeBasisCoeff
681 */
682 const auto &
684 {
685 if constexpr (std::is_same<ValueTypeBasisCoeff,
686 ValueTypeBasisData>::value)
687 {
689 }
690 else
691 {
693 }
694 }
695
696
697 /**
698 * @brief Cell level inverse sqrt diagonal mass matrix in ValueTypeBasisData
699 */
702
703
704 /**
705 * @brief Cell level inverse diagonal mass matrix in ValueTypeBasisData
706 */
709
710 /**
711 * @brief Cell level inverse diagonal mass matrix in ValueTypeBasisData
712 */
715 memorySpace> &
717
718 /**
719 * @brief Cell level sqrt diagonal mass matrix in ValueTypeBasisData
720 */
723
724
725 /**
726 * @brief Cell level diagonal mass matrix in ValueTypeBasisData
727 */
730
731 /**
732 * @brief Inverse sqrt diagonal mass matrix in ValueTypeBasisData
733 */
736
737 /**
738 * @brief Inverse diagonal mass matrix in ValueTypeBasisData
739 */
742
743 /**
744 * @brief Inverse diagonal mass matrix in ValueTypeBasisData
745 */
748 memorySpace> &
750
751 /**
752 * @brief sqrt diagonal mass matrix in ValueTypeBasisData
753 */
756
757 /**
758 * @brief diagonal mass matrix in ValueTypeBasisData
759 */
762
763 /**
764 * @brief diagonal stiffness matrix in ValueTypeBasisData
765 */
768
769 /**
770 * @brief diagonal inverse stiffness matrix in ValueTypeBasisData
771 */
774
775 /**
776 * @brief diagonal inverse sqrt stiffness matrix in ValueTypeBasisData
777 */
780
781 /**
782 * @brief diagonal sqrt stiffness matrix in ValueTypeBasisData
783 */
786
787 /**
788 * @brief returns 2 if all cells on current processor are Cartesian,
789 * 1 if all cells on current processor are affine and 0 otherwise.
790 */
793
794 /**
795 * @brief returns the deal.ii cellID corresponing to given cell Index.
796 * @param[in] iElem cell Index
797 */
798 dealii::CellId
799 cellID(const dftfe::uInt iElem) const;
800 /**
801 * @brief returns the deal.ii cell_iterator corresponing to given cell Index.
802 * @param[in] iElem cell Index
803 */
804
805 dealii::DoFHandler<3>::active_cell_iterator
806 getCellIterator(const dftfe::uInt iElem) const;
807
808 /**
809 * @brief returns the cell index corresponding to given deal.ii cellID.
810 * @param[in] iElem cell Index
811 */
813 cellIndex(const dealii::CellId cellid) const;
814
815 /**
816 * @brief Creates a multivector.
817 * @param[in] blocksize Number of vectors in the multivector.
818 * @param[out] multiVector the created multivector.
819 */
820 void
822 const dftfe::uInt blocksize,
824 &multiVector) const;
825
826 /**
827 * @brief Creates a multivector.
828 * @param[in] blocksize Number of vectors in the multivector.
829 * @param[out] multiVector the created multivector.
830 */
831 void
833 const dftfe::uInt blocksize,
836 memorySpace> &multiVector) const;
837
838 /**
839 * @brief Creates scratch multivectors.
840 * @param[in] vecBlockSize Number of vectors in the multivector.
841 * @param[out] numMultiVecs number of scratch multivectors needed with
842 * this vecBlockSize.
843 */
844 void
846 const dftfe::uInt numMultiVecs = 1) const;
847
848 /**
849 * @brief Creates single precision scratch multivectors.
850 * @param[in] vecBlockSize Number of vectors in the multivector.
851 * @param[out] numMultiVecs number of scratch multivectors needed with
852 * this vecBlockSize.
853 */
854 void
856 const dftfe::uInt vecBlockSize,
857 const dftfe::uInt numMultiVecs = 1) const;
858
859 /**
860 * @brief Clears scratch multivectors.
861 */
862 void
864
865 /**
866 * @brief Gets scratch multivectors.
867 * @param[in] vecBlockSize Number of vectors in the multivector.
868 * @param[out] numMultiVecs index of the multivector among those with the
869 * same vecBlockSize.
870 */
872 getMultiVector(const dftfe::uInt vecBlockSize,
873 const dftfe::uInt index = 0) const;
874
875 /**
876 * @brief Gets single precision scratch multivectors.
877 * @param[in] vecBlockSize Number of vectors in the multivector.
878 * @param[out] numMultiVecs index of the multivector among those with the
879 * same vecBlockSize.
880 */
883 memorySpace> &
885 const dftfe::uInt index = 0) const;
886
887 /**
888 * @brief Apply constraints on given multivector.
889 * @param[inout] multiVector the given multivector.
890 */
891 void
893 memorySpace> &multiVector,
894 dftfe::uInt constraintIndex =
895 std::numeric_limits<dftfe::uInt>::max()) const;
896
897
898
899 /**
900 * @brief Return the underlying deal.II matrixfree object.
901 */
902 const dealii::MatrixFree<3, ValueTypeBasisData> &
904
905 /**
906 * @brief Return the underlying deal.II dofhandler object.
907 */
908 const dealii::DoFHandler<3> &
910
911
912
913 std::vector<dftUtils::constraintMatrixInfo<memorySpace>> d_constraintInfo;
915 std::vector<const dealii::AffineConstraints<ValueTypeBasisData> *>
917 const dealii::MatrixFree<3, ValueTypeBasisData> *d_matrixFreeDataPtr;
920 std::map<dftfe::uInt,
921 dftfe::utils::MemoryStorage<ValueTypeBasisData,
924 dftfe::utils::MemoryStorage<ValueTypeBasisData,
929 std::vector<dealii::CellId> d_cellIndexToCellIdMap;
930 std::vector<dealii::DoFHandler<3>::active_cell_iterator>
932 std::map<dealii::CellId, dftfe::uInt> d_cellIdToCellIndexMap;
933 std::map<dftfe::uInt,
936 std::map<dftfe::uInt,
939 std::map<dftfe::uInt,
942 std::map<dftfe::uInt,
945 std::map<dftfe::uInt,
948 std::map<dftfe::uInt,
951 std::map<dftfe::uInt,
954
955 std::map<dftfe::uInt,
958 std::map<dftfe::uInt,
961 std::map<dftfe::uInt,
964 std::map<dftfe::uInt,
967 std::map<dftfe::uInt,
970 std::map<dftfe::uInt,
973
984
987 memorySpace>
1011 memorySpace>
1023 mutable std::map<
1025 std::vector<
1028
1045
1062
1063
1064 mutable std::map<
1068 memorySpace>>>
1070
1071 std::vector<dftfe::uInt> d_quadratureIDsVector;
1074 std::vector<dftfe::uInt> d_nQuadsPerCell;
1084 std::vector<UpdateFlags> d_updateFlags;
1085
1086 std::shared_ptr<const utils::mpi::MPIPatternP2P<memorySpace>>
1088
1089
1090 void
1092 distributedCPUVec<double> &nodalField,
1093 const dftfe::uInt dofHandlerId,
1094 const dftfe::uInt quadratureId,
1096 &quadratureValueData,
1098 &quadratureGradValueData,
1100 &quadratureHessianValueData,
1101 const bool isEvaluateGradData = false,
1102 const bool isEvaluateHessianData = false,
1103 const bool isEvaluateData = true) const;
1104
1105 void
1107 const distributedCPUVec<double> &nodalField,
1108 const dftfe::uInt dofHandlerId,
1109 const dftfe::uInt quadratureId,
1111 &quadratureValueData,
1113 &quadratureGradValueData,
1115 &quadratureHessianValueData,
1116 const bool isEvaluateGradData = false,
1117 const bool isEvaluateHessianData = false,
1118 const bool isEvaluateData = true) const;
1119
1120 /**
1121 * @brief Interpolate process level nodal data to cell level quadrature data.
1122 * @param[in] nodalData process level nodal data, the multivector should
1123 * already have ghost data and constraints should have been applied.
1124 * @param[out] quadratureValues Cell level quadrature values, indexed by
1125 * [iCell * d_nQuadsPerCell * d_nVectors + iQuad * d_nVectors + iVec].
1126 * @param[out] quadratureGradients Cell level quadrature gradients,
1127 * indexed by [iCell * 3 * d_nQuadsPerCell * d_nVectors + iDim *
1128 * d_nQuadsPerCell * d_nVectors + iQuad * d_nVectors + iVec].
1129 */
1130 void
1132 memorySpace> &nodalData,
1133 ValueTypeBasisCoeff *quadratureValues,
1134 ValueTypeBasisCoeff *quadratureGradients = NULL) const;
1135
1136 // FIXME Untested function
1137 /**
1138 * @brief Integrate cell level quadrature data times shape functions to process level nodal data.
1139 * @param[in] quadratureValues Cell level quadrature values, indexed by
1140 * [iCell * d_nQuadsPerCell * d_nVectors + iQuad * d_nVectors + iVec].
1141 * @param[in] quadratureGradients Cell level quadrature gradients,
1142 * indexed by [iCell * 3 * d_nQuadsPerCell * d_nVectors + iDim *
1143 * d_nQuadsPerCell * d_nVectors + iQuad * d_nVectors + iVec].
1144 * @param[out] nodalData process level nodal data.
1145 */
1146 void
1148 ValueTypeBasisCoeff *quadratureValues,
1149 ValueTypeBasisCoeff *quadratureGradients,
1151 &nodalData,
1153 &mapQuadIdToProcId) const;
1154
1155 /**
1156 * @brief Get cell level nodal data from process level nodal data.
1157 * @param[in] nodalData process level nodal data, the multivector should
1158 * already have ghost data and constraints should have been applied.
1159 * @param[out] cellNodalDataPtr Cell level nodal values, indexed by
1160 * [iCell * d_nDofsPerCell * d_nVectors + iDoF * d_nVectors + iVec].
1161 */
1162 void
1165 &nodalData,
1166 ValueTypeBasisCoeff *cellNodalDataPtr) const;
1167 // FIXME Untested function
1168 /**
1169 * @brief Accumulate cell level nodal data into process level nodal data.
1170 * @param[in] cellNodalDataPtr Cell level nodal values, indexed by
1171 * [iCell * d_nDofsPerCell * d_nVectors + iDoF * d_nVectors + iVec].
1172 * @param[out] nodalData process level nodal data.
1173 */
1174 void
1176 const ValueTypeBasisCoeff *cellNodalDataPtr,
1178 &nodalData) const;
1179
1180 /**
1181 * @brief Interpolate process level nodal data to cell level quadrature data.
1182 * @param[in] nodalData process level nodal data, the multivector should
1183 * already have ghost data and constraints should have been applied.
1184 * @param[out] quadratureValues Cell level quadrature values, indexed by
1185 * [iCell * d_nQuadsPerCell * d_nVectors + iQuad * d_nVectors + iVec].
1186 * @param[out] quadratureGradients Cell level quadrature gradients,
1187 * indexed by [iCell * 3 * d_nQuadsPerCell * d_nVectors + iDim *
1188 * d_nQuadsPerCell * d_nVectors + iQuad * d_nVectors + iVec].
1189 * @param[in] cellRange the range of cells for which interpolation has to
1190 * be done.
1191 */
1192 void
1194 const dftfe::linearAlgebra::MultiVector<ValueTypeBasisCoeff,
1195 memorySpace> &nodalData,
1196 ValueTypeBasisCoeff *quadratureValues,
1197 ValueTypeBasisCoeff *quadratureGradients,
1198 const std::pair<dftfe::uInt, dftfe::uInt> cellRange) const;
1199
1200 /**
1201 * @brief Interpolate cell level nodal data to cell level quadrature data.
1202 * @param[in] nodalData cell level nodal data, the multivector should
1203 * already have ghost data and constraints should have been applied.
1204 * @param[out] quadratureValues Cell level quadrature values, indexed by
1205 * [iCell * d_nQuadsPerCell * d_nVectors + iQuad * d_nVectors + iVec].
1206 * @param[out] quadratureGradients Cell level quadrature gradients,
1207 * indexed by [iCell * 3 * d_nQuadsPerCell * d_nVectors + iDim *
1208 * d_nQuadsPerCell * d_nVectors + iQuad * d_nVectors + iVec].
1209 * @param[in] cellRange the range of cells for which interpolation has to
1210 * be done.
1211 */
1212 void
1214 const ValueTypeBasisCoeff *nodalData,
1215 ValueTypeBasisCoeff *quadratureValues,
1216 ValueTypeBasisCoeff *quadratureGradients,
1217 const std::pair<dftfe::uInt, dftfe::uInt> cellRange) const;
1218
1219 // FIXME Untested function
1220 /**
1221 * @brief Integrate cell level quadrature data times shape functions to process level nodal data.
1222 * @param[in] quadratureValues Cell level quadrature values, indexed by
1223 * [iCell * d_nQuadsPerCell * d_nVectors + iQuad * d_nVectors + iVec].
1224 * @param[in] quadratureGradients Cell level quadrature gradients,
1225 * indexed by [iCell * 3 * d_nQuadsPerCell * d_nVectors + iDim *
1226 * d_nQuadsPerCell * d_nVectors + iQuad * d_nVectors + iVec].
1227 * @param[out] nodalData process level nodal data.
1228 * @param[in] cellRange the range of cells for which integration has to be
1229 * done.
1230 */
1231 void
1233 const ValueTypeBasisCoeff *quadratureValues,
1234 const ValueTypeBasisCoeff *quadratureGradients,
1236 &nodalData,
1238 &mapQuadIdToProcId,
1239 const std::pair<dftfe::uInt, dftfe::uInt> cellRange) const;
1240
1241
1242 /**
1243 * @brief Get cell level nodal data from process level nodal data.
1244 * @param[in] nodalData process level nodal data, the multivector should
1245 * already have ghost data and constraints should have been applied.
1246 * @param[out] cellNodalDataPtr Cell level nodal values, indexed by
1247 * [iCell * d_nDofsPerCell * d_nVectors + iDoF * d_nVectors + iVec].
1248 * @param[in] cellRange the range of cells for which extraction has to be
1249 * done.
1250 */
1251 void
1253 const dftfe::linearAlgebra::MultiVector<ValueTypeBasisCoeff,
1254 memorySpace> &nodalData,
1255 ValueTypeBasisCoeff *cellNodalDataPtr,
1256 const std::pair<dftfe::uInt, dftfe::uInt> cellRange) const;
1257
1258 // FIXME Untested function
1259 /**
1260 * @brief Accumulate cell level nodal data into process level nodal data.
1261 * @param[in] cellNodalDataPtr Cell level nodal values, indexed by
1262 * [iCell * d_nDofsPerCell * d_nVectors + iDoF * d_nVectors + iVec].
1263 * @param[out] nodalData process level nodal data.
1264 * @param[in] cellRange the range of cells for which extraction has to be
1265 * done.
1266 */
1267 void
1269 const ValueTypeBasisCoeff *cellNodalDataPtr,
1271 &nodalData,
1272 const std::pair<dftfe::uInt, dftfe::uInt> cellRange) const;
1273 };
1274 } // end of namespace basis
1275} // end of namespace dftfe
1276
1277#endif // dftfeBasisOperations_h
dftfe::uInt d_quadratureIndex
Definition FEBasisOperations.h:1073
dftfe::uInt nVectors() const
Number of vectors set in reinit.
void computeWeightedCellStiffnessMatrix(const std::pair< dftfe::uInt, dftfe::uInt > cellRangeTotal, dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > &weights, dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > &weightedCellStiffnessMatrix) const
std::vector< dftfe::uInt > d_quadratureIDsVector
Definition FEBasisOperations.h:1071
const auto & massVector() const
diagonal mass matrix in ValueTypeBasisCoeff
Definition FEBasisOperations.h:683
dealii::CellId cellID(const dftfe::uInt iElem) const
returns the deal.ii cellID corresponing to given cell Index.
const dftfe::utils::MemoryStorage< ValueTypeBasisData, dftfe::utils::MemorySpace::HOST > & quadPoints() const
quad point coordinates for each cell.
const dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > & inverseSqrtMassVectorBasisData() const
Inverse sqrt diagonal mass matrix in ValueTypeBasisData.
const auto & cellMassVector() const
Cell level diagonal mass matrix in ValueTypeBasisCoeff.
Definition FEBasisOperations.h:611
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_inverseMassVectorCoeffType
Definition FEBasisOperations.h:1014
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > d_cellSqrtStiffnessVectorBasisType
Definition FEBasisOperations.h:1034
std::map< dftfe::uInt, dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > > d_shapeFunctionBasisData
Definition FEBasisOperations.h:963
const auto & inverseSqrtMassVector() const
Inverse sqrt diagonal mass matrix in ValueTypeBasisCoeff.
Definition FEBasisOperations.h:629
bool areAllCellsAffine
Definition FEBasisOperations.h:1082
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_inverseSqrtMassVectorCoeffType
Definition FEBasisOperations.h:1018
const dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > & inverseStiffnessVectorBasisData() const
diagonal inverse stiffness matrix in ValueTypeBasisData
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_inverseSqrtStiffnessVectorCoeffType
Definition FEBasisOperations.h:1055
dftfe::utils::MemoryStorage< typename dftfe::dataTypes::singlePrecType< ValueTypeBasisData >::type, memorySpace > d_cellInverseMassVectorBasisTypeSinglePrec
Definition FEBasisOperations.h:988
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_cellSqrtMassVectorCoeffType
Definition FEBasisOperations.h:1002
std::map< dftfe::uInt, dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > > d_inverseJacobianData
Definition FEBasisOperations.h:935
const dealii::MatrixFree< 3, ValueTypeBasisData > * d_matrixFreeDataPtr
Definition FEBasisOperations.h:917
const auto & cellInverseMassVector() const
Cell level inverse diagonal mass matrix in ValueTypeBasisCoeff.
Definition FEBasisOperations.h:577
void initializeMPIPattern()
Constructs the MPIPatternP2P object.
dftfe::utils::MemoryStorage< ValueTypeBasisData, dftfe::utils::MemorySpace::HOST > d_cellCentroids
Definition FEBasisOperations.h:926
void interpolate(dftfe::linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &nodalData, ValueTypeBasisCoeff *quadratureValues, ValueTypeBasisCoeff *quadratureGradients=NULL) const
Interpolate process level nodal data to cell level quadrature data.
std::vector< dealii::DoFHandler< 3 >::active_cell_iterator > d_cellIndexToCellIteratorMap
Definition FEBasisOperations.h:931
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > tempCellGradientsBlock
Definition FEBasisOperations.h:91
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > d_cellInverseMassVectorBasisType
Definition FEBasisOperations.h:983
void accumulateFromCellNodalDataKernel(const ValueTypeBasisCoeff *cellNodalDataPtr, dftfe::linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &nodalData, const std::pair< dftfe::uInt, dftfe::uInt > cellRange) const
Accumulate cell level nodal data into process level nodal data.
dftfe::uInt d_locallyOwnedSize
Definition FEBasisOperations.h:1081
std::map< dealii::CellId, dftfe::uInt > d_cellIdToCellIndexMap
Definition FEBasisOperations.h:932
std::map< dftfe::uInt, dftfe::utils::MemoryStorage< ValueTypeBasisData, dftfe::utils::MemorySpace::HOST > > d_quadPoints
Definition FEBasisOperations.h:923
const dealii::DoFHandler< 3 > & getDofHandler() const
Return the underlying deal.II dofhandler object.
void computeCellMassMatrix(const dftfe::uInt quadratureID, const dftfe::uInt cellsBlockSize, const bool basisType=false, const bool ceoffType=true)
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_cellInverseSqrtStiffnessVectorCoeffType
Definition FEBasisOperations.h:1049
dftfe::uInt nOwnedDofs() const
Number of locally owned DoFs on the current processor.
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_massVectorCoeffType
Definition FEBasisOperations.h:1006
std::map< dftfe::uInt, dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > > d_shapeFunctionGradientDataInternalLayout
Definition FEBasisOperations.h:944
dealii::DoFHandler< 3 >::active_cell_iterator getCellIterator(const dftfe::uInt iElem) const
returns the deal.ii cell_iterator corresponing to given cell Index.
void computeWeightedCellNjGradNiMinusNiGradNjMatrix(const std::pair< dftfe::uInt, dftfe::uInt > cellRangeTotal, dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > &weights, dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > &weightedCellNjGradNiPlusNiGradNjMatrix) const
const dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > & cellStiffnessMatrixBasisData() const
Cell level stiffness matrix in ValueTypeBasisData.
const dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > & cellInverseMassVectorBasisData() const
Cell level inverse diagonal mass matrix in ValueTypeBasisData.
void initializeConstraints()
Initializes the constraintMatrixInfo object.
std::map< dftfe::uInt, dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > > d_shapeFunctionGradientDataTranspose
Definition FEBasisOperations.h:953
~FEBasisOperations()=default
Default Destructor.
dftfe::uInt d_dofHandlerID
Definition FEBasisOperations.h:1075
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > d_cellInverseStiffnessVectorBasisType
Definition FEBasisOperations.h:1032
std::map< dftfe::uInt, dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > > d_shapeFunctionData
Definition FEBasisOperations.h:941
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > d_inverseSqrtStiffnessVectorBasisType
Definition FEBasisOperations.h:1038
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > d_cellInverseSqrtStiffnessVectorBasisType
Definition FEBasisOperations.h:1036
const dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > & inverseJacobians() const
Inverse Jacobian matrices, for cartesian cells returns the diagonal elements of the inverse Jacobian ...
void extractToCellNodalData(dftfe::linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &nodalData, ValueTypeBasisCoeff *cellNodalDataPtr) const
Get cell level nodal data from process level nodal data.
std::map< dftfe::uInt, dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > > d_shapeFunctionDataTranspose
Definition FEBasisOperations.h:950
const auto & inverseJacobiansBasisData() const
Inverse Jacobian matrices in ValueTypeBasisData, for cartesian cells returns the diagonal elements of...
Definition FEBasisOperations.h:471
const auto & cellStiffnessMatrix() const
Cell level stiffness matrix in ValueTypeBasisCoeff.
Definition FEBasisOperations.h:510
std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< memorySpace > > d_BLASWrapperPtr
Definition FEBasisOperations.h:98
void computeCellStiffnessMatrix(const dftfe::uInt quadratureID, const dftfe::uInt cellsBlockSize, const bool basisType=false, const bool ceoffType=true)
Computes the cell-level stiffness matrix.
dftfe::uInt d_nCells
Definition FEBasisOperations.h:1077
dftfe::utils::MemoryStorage< dftfe::uInt, memorySpace > zeroIndexVec
Definition FEBasisOperations.h:94
const auto & shapeFunctionBasisData(bool transpose=false) const
Shape function values at quadrature points in ValueTypeBasisData.
Definition FEBasisOperations.h:418
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > d_stiffnessVectorBasisType
Definition FEBasisOperations.h:1044
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > tempCellGradientsBlock2
Definition FEBasisOperations.h:91
void createMultiVector(const dftfe::uInt blocksize, dftfe::linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &multiVector) const
Creates a multivector.
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > d_inverseSqrtMassVectorBasisType
Definition FEBasisOperations.h:1016
std::shared_ptr< const utils::mpi::MPIPatternP2P< memorySpace > > mpiPatternP2P
Definition FEBasisOperations.h:1087
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_sqrtStiffnessVectorCoeffType
Definition FEBasisOperations.h:1057
void computeInverseSqrtMassVector(const bool basisType=true, const bool ceoffType=false)
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_cellInverseStiffnessVectorCoeffType
Definition FEBasisOperations.h:1047
void createMultiVectorSinglePrec(const dftfe::uInt blocksize, dftfe::linearAlgebra::MultiVector< typename dftfe::dataTypes::singlePrecType< ValueTypeBasisCoeff >::type, memorySpace > &multiVector) const
Creates a multivector.
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_cellSqrtStiffnessVectorCoeffType
Definition FEBasisOperations.h:1053
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > d_inverseStiffnessVectorBasisType
Definition FEBasisOperations.h:1042
dftfe::uInt d_cellsBlockSize
Definition FEBasisOperations.h:1078
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > d_cellStiffnessVectorBasisType
Definition FEBasisOperations.h:1030
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_sqrtMassVectorCoeffType
Definition FEBasisOperations.h:1022
dftfe::uInt d_nVectors
Definition FEBasisOperations.h:1076
dftfe::uInt d_nOMPThreads
Definition FEBasisOperations.h:914
std::vector< dftfe::uInt > d_nQuadsPerCell
Definition FEBasisOperations.h:1074
dftfe::uInt nDofsPerCell() const
Number of DoFs per cell for the dofHandlerID set in init.
void accumulateFromCellNodalData(const ValueTypeBasisCoeff *cellNodalDataPtr, dftfe::linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &nodalData) const
Accumulate cell level nodal data into process level nodal data.
const dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > & massVectorBasisData() const
diagonal mass matrix in ValueTypeBasisData
void reinitializeConstraints(std::vector< const dealii::AffineConstraints< ValueTypeBasisData > * > &constraintsVector)
Reinitializes the constraintMatrixInfo object.
void computeScalarFieldTimesGradientShapeFunctionIntegral(const std::vector< dftfe::uInt > &cellIndices, const dftfe::uInt &noKpoints, const dftfe::uInt &noOfVectors, const dftfe::uInt &totalElements, const dftfe::uInt &iElemStart, const dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > &scalarField, dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > &scalarFieldTimesGradientShapeFunctionIntegral) const
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_cellMassMatrixCoeffType
Definition FEBasisOperations.h:981
void computeWeightedCellNjGradNiPlusNiGradNjMatrix(const std::pair< dftfe::uInt, dftfe::uInt > cellRangeTotal, dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > &weights, dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > &weightedCellNjGradNiPlusNiGradNjMatrix) const
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > d_sqrtMassVectorBasisType
Definition FEBasisOperations.h:1020
const dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > & shapeFunctionGradientData(bool transpose=false) const
Shape function gradient values at quadrature points.
std::vector< dealii::CellId > d_cellIndexToCellIdMap
Definition FEBasisOperations.h:929
void clearScratchMultiVectors() const
Clears scratch multivectors.
std::vector< UpdateFlags > d_updateFlags
Definition FEBasisOperations.h:1084
dftfe::utils::MemoryStorage< typename dftfe::dataTypes::singlePrecType< ValueTypeBasisData >::type, memorySpace > d_inverseMassVectorBasisTypeSinglePrec
Definition FEBasisOperations.h:1012
dftfe::linearAlgebra::MultiVector< typename dftfe::dataTypes::singlePrecType< ValueTypeBasisCoeff >::type, memorySpace > & getMultiVectorSinglePrec(const dftfe::uInt vecBlockSize, const dftfe::uInt index=0) const
Gets single precision scratch multivectors.
void computeScalarFieldTimesShapeFunctionIntegral(const std::vector< dftfe::uInt > &cellIndices, const dftfe::uInt &noKpoints, const dftfe::uInt &noOfVectors, const dftfe::uInt &totalElements, const dftfe::uInt &iElemStart, const dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > &scalarField, dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > &scalarFieldTimesShapeFunctionIntegral) const
const auto & sqrtMassVector() const
sqrt diagonal mass matrix in ValueTypeBasisCoeff
Definition FEBasisOperations.h:666
dftfe::uInt d_quadratureID
Definition FEBasisOperations.h:1072
std::map< dftfe::uInt, dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > > d_JxWData
Definition FEBasisOperations.h:938
void createScratchMultiVectors(const dftfe::uInt vecBlockSize, const dftfe::uInt numMultiVecs=1) const
Creates scratch multivectors.
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_inverseStiffnessVectorCoeffType
Definition FEBasisOperations.h:1061
const dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > & JxW() const
determinant of Jacobian times the quadrature weight at each quad point for each cell.
std::map< dftfe::uInt, std::vector< dftfe::linearAlgebra::MultiVector< typename dftfe::dataTypes::singlePrecType< ValueTypeBasisCoeff >::type, memorySpace > > > scratchMultiVectorsSinglePrec
Definition FEBasisOperations.h:1069
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > d_cellStiffnessMatrixBasisType
Definition FEBasisOperations.h:975
dftfe::utils::MemoryStorage< dftfe::uInt, memorySpace > d_flattenedCellDofIndexToProcessDofIndexMap
Definition FEBasisOperations.h:928
const dftfe::utils::MemoryStorage< typename dftfe::dataTypes::singlePrecType< ValueTypeBasisData >::type, memorySpace > & cellInverseMassVectorBasisDataSinglePrec() const
Cell level inverse diagonal mass matrix in ValueTypeBasisData.
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_cellStiffnessVectorCoeffType
Definition FEBasisOperations.h:1051
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > d_cellInverseSqrtMassVectorBasisType
Definition FEBasisOperations.h:992
void clear()
Clears the FEBasisOperations internal storage.
void integrateWithBasisKernel(const ValueTypeBasisCoeff *quadratureValues, const ValueTypeBasisCoeff *quadratureGradients, dftfe::linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &nodalData, dftfe::utils::MemoryStorage< dftfe::uInt, memorySpace > &mapQuadIdToProcId, const std::pair< dftfe::uInt, dftfe::uInt > cellRange) const
Integrate cell level quadrature data times shape functions to process level nodal data.
void interpolateKernel(const ValueTypeBasisCoeff *nodalData, ValueTypeBasisCoeff *quadratureValues, ValueTypeBasisCoeff *quadratureGradients, const std::pair< dftfe::uInt, dftfe::uInt > cellRange) const
Interpolate cell level nodal data to cell level quadrature data.
std::map< dftfe::uInt, dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > > d_shapeFunctionGradientData
Definition FEBasisOperations.h:947
const dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > & cellSqrtMassVectorBasisData() const
Cell level sqrt diagonal mass matrix in ValueTypeBasisData.
void integrateWithBasis(ValueTypeBasisCoeff *quadratureValues, ValueTypeBasisCoeff *quadratureGradients, dftfe::linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &nodalData, dftfe::utils::MemoryStorage< dftfe::uInt, memorySpace > &mapQuadIdToProcId) const
Integrate cell level quadrature data times shape functions to process level nodal data.
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > d_inverseMassVectorBasisType
Definition FEBasisOperations.h:1008
const auto & cellSqrtMassVector() const
Cell level sqrt diagonal mass matrix in ValueTypeBasisCoeff.
Definition FEBasisOperations.h:594
void createScratchMultiVectorsSinglePrec(const dftfe::uInt vecBlockSize, const dftfe::uInt numMultiVecs=1) const
Creates single precision scratch multivectors.
std::map< dftfe::uInt, dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > > d_shapeFunctionBasisDataTranspose
Definition FEBasisOperations.h:969
void computeStiffnessVector(const bool basisType=true, const bool ceoffType=false)
Computes the stiffness matrix \grad Ni . \grad Ni.
void computeVectorFieldDyadicGradientShapeFunctionIntegral(const std::vector< dftfe::uInt > &cellIndices, const dftfe::uInt &noKpoints, const dftfe::uInt &noOfVectors, const dftfe::uInt &totalElements, const dftfe::uInt &iElemStart, const dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > &vectorField, dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > &vectorFieldDyadicGradientShapeFunctionIntegral) const
void interpolateNoConstraints(const distributedCPUVec< double > &nodalField, const dftfe::uInt dofHandlerId, const dftfe::uInt quadratureId, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureValueData, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureGradValueData, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureHessianValueData, const bool isEvaluateGradData=false, const bool isEvaluateHessianData=false, const bool isEvaluateData=true) const
dftfe::uInt cellIndex(const dealii::CellId cellid) const
returns the cell index corresponding to given deal.ii cellID.
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > tempQuadratureGradientsData
Definition FEBasisOperations.h:88
std::map< dftfe::uInt, std::vector< dftfe::linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > > > scratchMultiVectors
Definition FEBasisOperations.h:1027
dftfe::uInt nCells() const
Number of locally owned cells on the current processor.
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > tempCellValuesBlockCoeff
Definition FEBasisOperations.h:96
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_cellStiffnessMatrixCoeffType
Definition FEBasisOperations.h:977
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_stiffnessVectorCoeffType
Definition FEBasisOperations.h:1059
const dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > & cellMassVectorBasisData() const
Cell level diagonal mass matrix in ValueTypeBasisData.
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_cellInverseSqrtMassVectorCoeffType
Definition FEBasisOperations.h:994
std::vector< const dealii::AffineConstraints< ValueTypeBasisData > * > * d_constraintsVector
Definition FEBasisOperations.h:916
const auto & inverseMassVector() const
Inverse sqrt diagonal mass matrix in ValueTypeBasisCoeff.
Definition FEBasisOperations.h:648
dftfe::uInt d_localSize
Definition FEBasisOperations.h:1080
const dftfe::utils::MemoryStorage< typename dftfe::dataTypes::singlePrecType< ValueTypeBasisData >::type, memorySpace > & inverseMassVectorBasisDataSinglePrec() const
Inverse diagonal mass matrix in ValueTypeBasisData.
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > tempCellValuesBlock
Definition FEBasisOperations.h:91
void computeWeightedCellMassMatrix(const std::pair< dftfe::uInt, dftfe::uInt > cellRangeTotal, dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > &weights, dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > &weightedCellMassMatrix) const
dftfe::linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > & getMultiVector(const dftfe::uInt vecBlockSize, const dftfe::uInt index=0) const
Gets scratch multivectors.
void initializeShapeFunctionAndJacobianData()
Fill the shape function data and jacobian data in the ValueTypeBasisCoeff datatype.
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > d_cellSqrtMassVectorBasisType
Definition FEBasisOperations.h:1000
void initializeShapeFunctionAndJacobianBasisData()
Fill the shape function data and jacobian data in the ValueTypeBasisData datatype.
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_cellInverseMassVectorCoeffType
Definition FEBasisOperations.h:990
void reinit(const dftfe::uInt &vecBlockSize, const dftfe::uInt &cellBlockSize, const dftfe::uInt &quadratureID, const bool isResizeTempStorageForInerpolation=true, const bool isResizeTempStorageForCellMatrices=false, const bool isResizeTempStorageForIntegralEvaluations=false)
sets internal variables and optionally resizes internal temp storage for interpolation operations
dftfe::uInt nQuadsPerCell() const
Number of quadrature points per cell for the quadratureID set in reinit.
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > d_sqrtStiffnessVectorBasisType
Definition FEBasisOperations.h:1040
dftfe::uInt cellsTypeFlag() const
returns 2 if all cells on current processor are Cartesian, 1 if all cells on current processor are af...
const auto & JxWBasisData() const
determinant of Jacobian times the quadrature weight in ValueTypeBasisData at each quad point for each...
Definition FEBasisOperations.h:493
void interpolateKernel(const dftfe::linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &nodalData, ValueTypeBasisCoeff *quadratureValues, ValueTypeBasisCoeff *quadratureGradients, const std::pair< dftfe::uInt, dftfe::uInt > cellRange) const
Interpolate process level nodal data to cell level quadrature data.
const dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > & sqrtStiffnessVectorBasisData() const
diagonal sqrt stiffness matrix in ValueTypeBasisData
void init(const FEBasisOperations< ValueTypeBasisCoeff, ValueTypeBasisData, memorySpaceSrc > &basisOperationsSrc)
fills required data structures from another FEBasisOperations object
void computeWeightedCellNjGradNiMatrix(const std::pair< dftfe::uInt, dftfe::uInt > cellRangeTotal, dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > &weights, dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > &weightedCellNjGradNiMatrix) const
void init(dealii::MatrixFree< 3, ValueTypeBasisData > &matrixFreeData, std::vector< const dealii::AffineConstraints< ValueTypeBasisData > * > &constraintsVector, const dftfe::uInt &dofHandlerID, const std::vector< dftfe::uInt > &quadratureID, const std::vector< UpdateFlags > updateFlags)
fills required data structures for the given dofHandlerID
bool areAllCellsCartesian
Definition FEBasisOperations.h:1083
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > tempCellNodalData
Definition FEBasisOperations.h:88
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > d_cellMassVectorBasisType
Definition FEBasisOperations.h:996
void initializeFlattenedIndexMaps()
Initializes indexset maps from process level indices to cell level indices for multivectors.
const auto & cellInverseSqrtMassVector() const
Cell level inverse sqrt diagonal mass matrix in ValueTypeBasisCoeff.
Definition FEBasisOperations.h:560
void initializeIndexMaps()
Initializes indexset maps from process level indices to cell level indices for a single vector,...
dftfe::utils::MemoryStorage< dftfe::uInt, dftfe::utils::MemorySpace::HOST > d_cellDofIndexToProcessDofIndexMap
Definition FEBasisOperations.h:919
dftfe::uInt d_nDofsPerCell
Definition FEBasisOperations.h:1079
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > tempCellGradientsBlockCoeff
Definition FEBasisOperations.h:96
std::vector< dftUtils::constraintMatrixInfo< memorySpace > > d_constraintInfo
Definition FEBasisOperations.h:913
const dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > & inverseSqrtStiffnessVectorBasisData() const
diagonal inverse sqrt stiffness matrix in ValueTypeBasisData
std::map< dftfe::uInt, dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > > d_shapeFunctionGradientBasisData
Definition FEBasisOperations.h:966
FEBasisOperations(std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< memorySpace > > BLASWrapperPtr)
Constructor.
void interpolate(distributedCPUVec< double > &nodalField, const dftfe::uInt dofHandlerId, const dftfe::uInt quadratureId, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureValueData, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureGradValueData, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureHessianValueData, const bool isEvaluateGradData=false, const bool isEvaluateHessianData=false, const bool isEvaluateData=true) const
void extractToCellNodalDataKernel(const dftfe::linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &nodalData, ValueTypeBasisCoeff *cellNodalDataPtr, const std::pair< dftfe::uInt, dftfe::uInt > cellRange) const
Get cell level nodal data from process level nodal data.
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_cellMassVectorCoeffType
Definition FEBasisOperations.h:998
std::map< dftfe::uInt, dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > > d_JxWBasisData
Definition FEBasisOperations.h:960
const dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > & inverseMassVectorBasisData() const
Inverse diagonal mass matrix in ValueTypeBasisData.
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > tempCellMatrixBlock
Definition FEBasisOperations.h:92
const dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > & sqrtMassVectorBasisData() const
sqrt diagonal mass matrix in ValueTypeBasisData
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > d_cellMassMatrixBasisType
Definition FEBasisOperations.h:979
void distribute(dftfe::linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &multiVector, dftfe::uInt constraintIndex=std::numeric_limits< dftfe::uInt >::max()) const
Apply constraints on given multivector.
const dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > & stiffnessVectorBasisData() const
diagonal stiffness matrix in ValueTypeBasisData
const dftfe::utils::MemoryStorage< ValueTypeBasisData, dftfe::utils::MemorySpace::HOST > & cellCentroids() const
quad point coordinates for each cell.
dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > tempQuadratureGradientsDataNonAffine
Definition FEBasisOperations.h:89
std::map< dftfe::uInt, dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > > d_shapeFunctionGradientBasisDataTranspose
Definition FEBasisOperations.h:972
const dftfe::utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > & shapeFunctionData(bool transpose=false) const
Shape function values at quadrature points.
dftfe::uInt nRelaventDofs() const
Number of DoFs on the current processor, locally owned + ghosts.
const auto & cellMassMatrix() const
Cell level mass matrix in ValueTypeBasisCoeff.
Definition FEBasisOperations.h:535
const auto & shapeFunctionGradientBasisData(bool transpose=false) const
Shape function gradient values at quadrature points in ValueTypeBasisData.
Definition FEBasisOperations.h:443
const dealii::MatrixFree< 3, ValueTypeBasisData > & matrixFreeData() const
Return the underlying deal.II matrixfree object.
void resizeTempStorage(const bool isResizeTempStorageForInerpolation, const bool isResizeTempStorageForCellMatrices, const bool isResizeTempStorageForIntegralEvaluations)
Resizes the internal temp storage to be sufficient for the vector and cell block sizes provided in re...
const dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > & cellInverseSqrtMassVectorBasisData() const
Cell level inverse sqrt diagonal mass matrix in ValueTypeBasisData.
const dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > & cellMassMatrixBasisData() const
Cell level mass matrix in ValueTypeBasisData.
dftfe::utils::MemoryStorage< dftfe::uInt, dftfe::utils::MemorySpace::HOST > & getFlattenedMapsHost()
dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > d_massVectorBasisType
Definition FEBasisOperations.h:1004
std::map< dftfe::uInt, dftfe::utils::MemoryStorage< ValueTypeBasisData, memorySpace > > d_inverseJacobianBasisData
Definition FEBasisOperations.h:957
Definition BLASWrapper.h:35
An class template to encapsulate a MultiVector. A MultiVector is a collection of vectors belonging t...
Definition MultiVector.h:127
Definition MemoryStorage.h:33
Definition FEBasisOperations.h:30
UpdateFlags operator|(const UpdateFlags f1, const UpdateFlags f2)
Definition FEBasisOperations.h:49
UpdateFlags & operator|=(UpdateFlags &f1, const UpdateFlags f2)
Definition FEBasisOperations.h:58
UpdateFlags
Definition FEBasisOperations.h:32
@ update_values
Definition FEBasisOperations.h:35
@ update_quadpoints
Definition FEBasisOperations.h:41
@ update_transpose
Definition FEBasisOperations.h:39
@ update_inversejacobians
Definition FEBasisOperations.h:43
@ update_jxw
Definition FEBasisOperations.h:45
@ update_default
Definition FEBasisOperations.h:33
@ update_gradients
Definition FEBasisOperations.h:37
UpdateFlags operator&(const UpdateFlags f1, const UpdateFlags f2)
Definition FEBasisOperations.h:66
UpdateFlags & operator&=(UpdateFlags &f1, const UpdateFlags f2)
Definition FEBasisOperations.h:74
MemorySpace
Definition MemorySpaceType.h:33
@ HOST
Definition MemorySpaceType.h:34
Definition pseudoPotentialToDftfeConverter.cc:34
dealii::LinearAlgebra::distributed::Vector< elem_type, dealii::MemorySpace::Host > distributedCPUVec
Definition headers.h:92
std::uint32_t uInt
Definition TypeConfig.h:10
T type
Definition dftfeDataTypes.h:112