OpenPFC  0.1.4
Phase Field Crystal simulation framework
Loading...
Searching...
No Matches
typename.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 VTT Technical Research Centre of Finland Ltd
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
37#ifndef PFC_TYPENAME_HPP
38#define PFC_TYPENAME_HPP
39
40#include <complex>
41#include <string>
42#include <type_traits>
43#include <typeinfo>
44
45namespace pfc {
46
47// Type trait to retrieve the human-readable type name
48template <typename T> struct TypeName {
49 static std::string get() { return typeid(T).name(); }
50};
51
52// Specialization for int
53template <> struct TypeName<int> {
54 static std::string get() { return "int"; }
55};
56
57// Specialization for float
58template <> struct TypeName<float> {
59 static std::string get() { return "float"; }
60};
61
62// Specialization for double
63template <> struct TypeName<double> {
64 static std::string get() { return "double"; }
65};
66
67// Specialization for complex<double>
68template <typename T> struct TypeName<std::complex<T>> {
69 static std::string get() { return "complex<" + TypeName<T>::get() + ">"; }
70};
71
72} // namespace pfc
73
74#endif
Definition typename.hpp:48
Represents the global simulation domain (the "world").
Definition world.hpp:91