11 #ifndef __utlDMRIStoredTables_h 12 #define __utlDMRIStoredTables_h 39 if (!lutExp->IsTableBuilt())
42 lutExp->SetVariableMax(0);
43 lutExp->SetVariableMin(-30);
44 lutExp->SetNumberOfBins(30*5e3);
53 return lutExp->GetFunctionValue(x);
64 static utl_shared_ptr<NDArray<double,3> >
SH3IntegralTable(
new NDArray<double,3>);
73 template <
class T=
double >
79 typedef utl_shared_ptr<GradientTable<T> >
Pointer;
98 m_Instance = utl_shared_ptr<Self>(
new Self());
99 if (m_Instance->m_GradTable.size()!=7)
101 m_Instance->m_GradTable.resize(7);
102 for (
int i = 0; i < 7; ++i )
103 m_Instance->m_GradTable[i] = MatrixPointer(
new MatrixType());
113 utlSAGlobalException(tessorder<1 || tessorder>7)(tessorder).msg(
"wrong tess order. tessorder should be in [1,7]");
114 Pointer instance = GetInstance();
115 MatrixPointer mat = instance->m_GradTable[tessorder-1];
125 default :
utlSAGlobalException(
true)(tessorder).msg(
"wrong tess order. tessorder should be in [1,7]");
break;
127 instance->m_GradTable[tessorder-1] = mat;
135 utlSAGlobalException(tessorder<1 || tessorder>7)(tessorder).msg(
"wrong tess order. tessorder should be in [1,7]");
138 Pointer instance = GetInstance();
139 MatrixPointer grad = instance->m_GradTable[tessorder-1];
140 utlException(grad->Size()==0,
"call Initialize first to read grad");
141 MatrixPointer mat(
new MatrixType());
143 mat->ReSize(2*grad->Rows(),3);
145 mat->ReSize(grad->Rows(),3);
147 for (
int i=0, j=0; i < grad->Rows(); ++i, ++j )
149 (*mat)(j,0) = flipx==
DIRECTION_FLIP ? -(*grad)(i,0) : (*grad)(i,0);
150 (*mat)(j,1) = flipy==
DIRECTION_FLIP ? -(*grad)(i,1) : (*grad)(i,1);
151 (*mat)(j,2) = flipz==
DIRECTION_FLIP ? -(*grad)(i,2) : (*grad)(i,2);
156 (*mat)(j,0) = -(*mat)(j-1,0);
157 (*mat)(j,1) = -(*mat)(j-1,1);
158 (*mat)(j,2) = -(*mat)(j-1,2);
188 inline utl_shared_ptr<NDArray<T,2> >
198 inline utl_shared_ptr<NDArray<float,2> >
200 const int flipx,
const int flipy,
const int flipz,
const bool need_normalize)
202 utl_shared_ptr< utl::Matrix<double> > grad = utl::ReadGrad<double>(tess, NoSymmetricDuple, mode, flipx, flipy, flipz);
209 inline utl_shared_ptr<NDArray<T,2> >
215 sprintf(buf,
"00%d", num);
217 sprintf(buf,
"0%d", num);
219 sprintf(buf,
"%d", num);
220 std::string index (buf);
222 return ReadGrad<T>(file, NoSymmetricDuple, mode, flipx, flipy, flipz, need_normalize);
NDArray<T,1> is a vector class which uses blas mkl.
static std::shared_ptr< NDArray< double, 3 > > SH3IntegralTable(new NDArray< double, 3 >)
static const std::string DirectionsT5
static MatrixPointer GetGrad(const int tessorder, const int NoSymmetricDuple=DIRECTION_NODUPLICATE, const int mode=CARTESIAN_TO_SPHERICAL, const int flipx=DIRECTION_NOFLIP, const int flipy=DIRECTION_NOFLIP, const int flipz=DIRECTION_NOFLIP, const bool need_normalize=true)
use UnaryFunctorLookUpTable to accelerate evaluation of functions.
std::shared_ptr< NDArray< T, 2 > > ReadGrad(const int tess, const int NoSymmetricDuple=DIRECTION_NODUPLICATE, const int mode=CARTESIAN_TO_SPHERICAL, const int flipx=DIRECTION_NOFLIP, const int flipy=DIRECTION_NOFLIP, const int flipz=DIRECTION_NOFLIP, const bool need_normalize=true)
static LUTExpPointer lutExp
gradient table related functions and stored tables.
#define utlException(cond, expout)
#define utlSAGlobalException(expr)
NDArray<T,2> is a row-major matrix.
static const std::string DirectionsT7
LUTExpType::Pointer LUTExpPointer
static Pointer GetInstance()
utl::NDArray< T, 1 > VectorType
NDArray< T, 2 > CartesianToSpherical(const NDArray< T, 2 > &in)
std::string CreateExpandedPath(const std::string &path)
static const std::string DirectionsT3
static Pointer m_Instance
SmartPointer< Self > Pointer
std::shared_ptr< NDArray< T, 2 > > ReadGradElectricRepulsion(const int num, const int NoSymmetricDuple=DIRECTION_NODUPLICATE, const int mode=CARTESIAN_TO_SPHERICAL, const int flipx=DIRECTION_NOFLIP, const int flipy=DIRECTION_NOFLIP, const int flipz=DIRECTION_NOFLIP, const bool need_normalize=true)
#define utlSAException(expr)
UnaryFunctorLookUpTable< utl::Functor::Exp< double > > LUTExpType
std::shared_ptr< GradientTable< T > > Pointer
static void Initialize(const int tessorder)
std::vector< MatrixPointer > m_GradTable
std::shared_ptr< NDArray< float, 2 > > ReadGrad< float >(const int tess, const int NoSymmetricDuple, const int mode, const int flipx, const int flipy, const int flipz, const bool need_normalize)
std::shared_ptr< MatrixType > MatrixPointer
static const std::string GradientsElec
double lutExpValue(const double x)
utl::NDArray< T, 2 > MatrixType
static const std::string DirectionsT6
static const std::string DirectionsT2
static const std::string DirectionsT1
static const std::string DirectionsT4