IgANet
IgANets - Isogeometric Analysis Networks
Loading...
Searching...
No Matches
fqn.hpp
Go to the documentation of this file.
1
15#pragma once
16
17#include <core.hpp>
18
19#include <torch/csrc/api/include/torch/types.h>
20#include <torch/torch.h>
21
22namespace iganet {
23namespace utils {
24
27public:
31 inline const virtual std::string &name() const noexcept {
32 // If the name optional is empty at this point, we grab the name of the
33 // dynamic type via RTTI. Note that we cannot do this in the constructor,
34 // because in the constructor of a base class `this` always refers to the
35 // base type. Inheritance effectively does not work in constructors. Also
36 // this note from http://en.cppreference.com/w/cpp/language/typeid: If
37 // typeid is used on an object under construction or destruction (in a
38 // destructor or in a constructor, including constructor's initializer list
39 // or default member initializers), then the std::type_info object referred
40 // to by this typeid represents the class that is being constructed or
41 // destroyed even if it is not the most-derived class.
42 if (!name_.has_value()) {
43 name_ = c10::demangle(typeid(*this).name());
44#if defined(_WIN32)
45 // Windows adds "struct" or "class" as a prefix.
46 if (name_->find("struct ") == 0) {
47 name_->erase(name_->begin(), name_->begin() + 7);
48 } else if (name_->find("class ") == 0) {
49 name_->erase(name_->begin(), name_->begin() + 6);
50 }
51#endif // defined(_WIN32)
52 }
53 return *name_;
54 }
55
57 inline virtual void
58 pretty_print(std::ostream &os = Log(log::info)) const noexcept = 0;
59
60protected:
62 mutable at::optional<std::string> name_;
63};
64
65} // namespace utils
66} // namespace iganet
Full qualified name descriptor.
Definition fqn.hpp:26
virtual void pretty_print(std::ostream &os=Log(log::info)) const noexcept=0
Returns a string representation.
virtual const std::string & name() const noexcept
Returns the full qualified name of the object.
Definition fqn.hpp:31
at::optional< std::string > name_
String storing the full qualified name of the object.
Definition fqn.hpp:62
Core components.
Definition boundary.hpp:22
constexpr bool is_SplineType_v
Alias to the value of is_SplineType.
Definition bspline.hpp:3243
struct iganet::@0 Log
Logger.