DFT-EFE
 
Loading...
Searching...
No Matches
AtomSuperpositionFunction.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (c) 2021. *
3 * The Regents of the University of Michigan and DFT-EFE developers. *
4 * *
5 * This file is part of the DFT-EFE code. *
6 * *
7 * DFT-EFE is free software: you can redistribute it and/or modify *
8 * it under the terms of the Lesser GNU General Public License as *
9 * published by the Free Software Foundation, either version 3 of *
10 * the License, or (at your option) any later version. *
11 * *
12 * DFT-EFE is distributed in the hope that it will be useful, but *
13 * WITHOUT ANY WARRANTY; without even the implied warranty *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
15 * See the Lesser GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU Lesser General Public *
18 * License at the top level of DFT-EFE distribution. If not, see *
19 * <https://www.gnu.org/licenses/>. *
20 ******************************************************************************/
21
22/*
23 * @author Avirup Sircar
24 */
25
26#ifndef dftefeAtomSuperpositionFunction_h
27#define dftefeAtomSuperpositionFunction_h
28
30#include <utils/TypeConfig.h>
31#include <utils/Point.h>
33#include <utils/MemoryStorage.h>
36#include <memory>
40
41namespace dftefe
42{
43 namespace atoms
44 {
46 {
48 Grad,
49 IdentitySq, // for the adaptive quadrature builfing
51 };
52
53 template <utils::MemorySpace memorySpace>
55 {
56 public:
58 std::shared_ptr<const AtomSphericalDataContainer>
59 atomSphericalDataContainer,
60 const std::vector<std::string> & atomSymbol,
61 const std::vector<utils::Point> & atomCoordinates,
62 const std::string fieldName,
63 linearAlgebra::LinAlgOpContext<memorySpace> *linAlgOpContext = nullptr);
64
65 void
66 evaluate(const size_type numPoints,
67 const AtomSuperpositionFuncType atomSupType,
68 const double * t,
69 double * q,
70 const double constant = 1.0,
71 const std::vector<double> & atomWeights = {}) const
72 {
73#ifdef DFTEFE_WITH_DEVICE
74 if (memorySpace == utils::MemorySpace::DEVICE)
75 evalDevice(numPoints, atomSupType, constant, t, q, atomWeights);
76 else
77#endif
78 evalHost(numPoints, atomSupType, constant, t, q, atomWeights);
79 }
80
81 void
82 evaluateHost(const size_type numPoints,
83 const AtomSuperpositionFuncType atomSupType,
84 const double * t,
85 double * q,
86 const double constant = 1.0,
87 const std::vector<double> & atomWeights = {}) const
88 {
89 evalHost(numPoints, atomSupType, constant, t, q, atomWeights);
90 }
91
92 protected:
93 void
94 evalHost(size_type numPoints,
95 const AtomSuperpositionFuncType atomSupType,
96 const double constant,
97 const double * t,
98 double * q,
99 const std::vector<double> & atomWeights = {}) const;
100
101#ifdef DFTEFE_WITH_DEVICE
102 void
103 evalDevice(size_type numPoints,
104 const AtomSuperpositionFuncType atomSupType,
105 const double constant,
106 const double * t,
107 double * q,
108 const std::vector<double> & atomWeights = {}) const;
109#endif
110
111 protected:
112 const std::shared_ptr<const AtomSphericalDataContainer>
114 const std::vector<std::string> d_atomSymbolVec;
115 std::vector<utils::Point> d_atomCoordinatesVec;
116 const std::string d_fieldName;
119
120 std::vector<std::shared_ptr<SphericalData>> d_sphericalDataVecAll;
121 std::vector<size_type> d_enrichmentToAtomId;
123
126 // mutable utils::MemoryStorage<double, memorySpace> d_values;
127 };
128
129 } // namespace atoms
130} // namespace dftefe
131
133
134#endif // dftefeAtomSuperpositionFunction_h
Definition: AtomSuperpositionFunction.h:55
const std::shared_ptr< const AtomSphericalDataContainer > d_atomSphericalDataContainer
Definition: AtomSuperpositionFunction.h:113
size_type d_numEnrichmentFuncTotal
Definition: AtomSuperpositionFunction.h:122
void evalHost(size_type numPoints, const AtomSuperpositionFuncType atomSupType, const double constant, const double *t, double *q, const std::vector< double > &atomWeights={}) const
Definition: AtomSuperpositionFunction.t.cpp:69
utils::MemoryStorage< double, memorySpace > d_originsFlat
Definition: AtomSuperpositionFunction.h:125
size_type d_numAtoms
Definition: AtomSuperpositionFunction.h:117
const std::vector< std::string > d_atomSymbolVec
Definition: AtomSuperpositionFunction.h:114
std::vector< size_type > d_enrichmentToAtomId
Definition: AtomSuperpositionFunction.h:121
void evaluateHost(const size_type numPoints, const AtomSuperpositionFuncType atomSupType, const double *t, double *q, const double constant=1.0, const std::vector< double > &atomWeights={}) const
Definition: AtomSuperpositionFunction.h:82
void evaluate(const size_type numPoints, const AtomSuperpositionFuncType atomSupType, const double *t, double *q, const double constant=1.0, const std::vector< double > &atomWeights={}) const
Definition: AtomSuperpositionFunction.h:66
const std::string d_fieldName
Definition: AtomSuperpositionFunction.h:116
size_type d_dim
Definition: AtomSuperpositionFunction.h:118
linearAlgebra::LinAlgOpContext< memorySpace > * d_linAlgOpContext
Definition: AtomSuperpositionFunction.h:124
std::vector< std::shared_ptr< SphericalData > > d_sphericalDataVecAll
Definition: AtomSuperpositionFunction.h:120
std::vector< utils::Point > d_atomCoordinatesVec
Definition: AtomSuperpositionFunction.h:115
Definition: LinAlgOpContext.h:52
Definition: MemoryStorage.h:38
AtomSuperpositionFuncType
Definition: AtomSuperpositionFunction.h:46
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
std::uint64_t size_type
Definition: TypeConfig.h:9