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 typedef dealii::types::global_dof_index global_size_type;
37 typedef unsigned int local_size_type;
38#ifdef USE_COMPLEX
39 typedef std::complex<double> number;
40 typedef std::complex<float> numberFP32;
41 typedef double numberValueType;
42 typedef float numberFP32ValueType;
43#else
44 typedef double number;
45 typedef float numberFP32;
46 typedef double numberValueType;
47 typedef float numberFP32ValueType;
48#endif
49
50 inline MPI_Datatype
51 mpi_type_id(const int *)
52 {
53 return MPI_INT;
54 }
55
56 inline MPI_Datatype
57 mpi_type_id(const long int *)
58 {
59 return MPI_LONG;
60 }
61
62 inline MPI_Datatype
63 mpi_type_id(const unsigned int *)
64 {
65 return MPI_UNSIGNED;
66 }
67
68 inline MPI_Datatype
69 mpi_type_id(const unsigned long int *)
70 {
71 return MPI_UNSIGNED_LONG;
72 }
73
74 inline MPI_Datatype
75 mpi_type_id(const unsigned long long int *)
76 {
77 return MPI_UNSIGNED_LONG_LONG;
78 }
79
80
81 inline MPI_Datatype
82 mpi_type_id(const float *)
83 {
84 return MPI_FLOAT;
85 }
86
87
88 inline MPI_Datatype
89 mpi_type_id(const double *)
90 {
91 return MPI_DOUBLE;
92 }
93
94 inline MPI_Datatype
95 mpi_type_id(const long double *)
96 {
97 return MPI_LONG_DOUBLE;
98 }
99
100 inline MPI_Datatype
101 mpi_type_id(const std::complex<float> *)
102 {
103 return MPI_COMPLEX;
104 }
105
106 inline MPI_Datatype
107 mpi_type_id(const std::complex<double> *)
108 {
109 return MPI_DOUBLE_COMPLEX;
110 }
111
112 template <typename T>
114 {
115 typedef T type;
116 };
117
118 template <>
119 struct singlePrecType<double>
120 {
121 typedef float type;
122 };
123
124 template <>
125 struct singlePrecType<std::complex<double>>
126 {
127 typedef std::complex<float> type;
128 };
129
130 } // namespace dataTypes
131} // namespace dftfe
132
133#endif
Definition dftfeDataTypes.h:35
double numberValueType
Definition dftfeDataTypes.h:46
dealii::types::global_dof_index global_size_type
Definition dftfeDataTypes.h:36
unsigned int local_size_type
Definition dftfeDataTypes.h:37
float numberFP32ValueType
Definition dftfeDataTypes.h:47
double number
Definition dftfeDataTypes.h:44
MPI_Datatype mpi_type_id(const int *)
Definition dftfeDataTypes.h:51
float numberFP32
Definition dftfeDataTypes.h:45
Definition pseudoPotentialToDftfeConverter.cc:34
float type
Definition dftfeDataTypes.h:121
std::complex< float > type
Definition dftfeDataTypes.h:127
Definition dftfeDataTypes.h:114
T type
Definition dftfeDataTypes.h:115