DFT-FE 1.1.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
dftfeDataTypes.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// @author Sambit Das
18//
19
20#ifndef dftfeDataTypes_H_
21#define dftfeDataTypes_H_
22
23#include <deal.II/base/config.h>
24#include <deal.II/base/types.h>
25
26// Include generic C++ headers
27#include <fstream>
28#include <iostream>
29#include <fenv.h>
30
31// commonly used typedefs used in dftfe go here
32namespace dftfe
33{
34 namespace dataTypes
35 {
36#ifdef USE_COMPLEX
37 typedef std::complex<double> number;
38 typedef std::complex<float> numberFP32;
39 typedef double numberValueType;
40 typedef float numberFP32ValueType;
41#else
42 typedef double number;
43 typedef float numberFP32;
44 typedef double numberValueType;
45 typedef float numberFP32ValueType;
46#endif
47
48 inline MPI_Datatype
49 mpi_type_id(const int *)
50 {
51 return MPI_INT;
52 }
53
54 inline MPI_Datatype
55 mpi_type_id(const long int *)
56 {
57 return MPI_LONG;
58 }
59
60 inline MPI_Datatype
61 mpi_type_id(const unsigned int *)
62 {
63 return MPI_UNSIGNED;
64 }
65
66 inline MPI_Datatype
67 mpi_type_id(const unsigned long int *)
68 {
69 return MPI_UNSIGNED_LONG;
70 }
71
72 inline MPI_Datatype
73 mpi_type_id(const unsigned long long int *)
74 {
75 return MPI_UNSIGNED_LONG_LONG;
76 }
77
78
79 inline MPI_Datatype
80 mpi_type_id(const float *)
81 {
82 return MPI_FLOAT;
83 }
84
85
86 inline MPI_Datatype
87 mpi_type_id(const double *)
88 {
89 return MPI_DOUBLE;
90 }
91
92 inline MPI_Datatype
93 mpi_type_id(const long double *)
94 {
95 return MPI_LONG_DOUBLE;
96 }
97
98 inline MPI_Datatype
99 mpi_type_id(const std::complex<float> *)
100 {
101 return MPI_COMPLEX;
102 }
103
104 inline MPI_Datatype
105 mpi_type_id(const std::complex<double> *)
106 {
107 return MPI_DOUBLE_COMPLEX;
108 }
109
110 template <typename T>
112 {
113 typedef T type;
114 };
115
116 template <>
117 struct singlePrecType<double>
118 {
119 typedef float type;
120 };
121
122 template <>
123 struct singlePrecType<std::complex<double>>
124 {
125 typedef std::complex<float> type;
126 };
127
128 } // namespace dataTypes
129} // namespace dftfe
130
131#endif
Definition dftfeDataTypes.h:35
double numberValueType
Definition dftfeDataTypes.h:44
float numberFP32ValueType
Definition dftfeDataTypes.h:45
double number
Definition dftfeDataTypes.h:42
MPI_Datatype mpi_type_id(const int *)
Definition dftfeDataTypes.h:49
float numberFP32
Definition dftfeDataTypes.h:43
Definition pseudoPotentialToDftfeConverter.cc:34
float type
Definition dftfeDataTypes.h:119
std::complex< float > type
Definition dftfeDataTypes.h:125
Definition dftfeDataTypes.h:112
T type
Definition dftfeDataTypes.h:113