KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
code_location.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Author1 Pooyan Dadvand
11 //
12 //
13 
14 #if !defined(KRATOS_CODE_LOCATION_H_INCLUDED )
15 #define KRATOS_CODE_LOCATION_H_INCLUDED
16 
17 // System includes
18 #include <string>
19 #include <iostream>
20 
22 
23 namespace Kratos
24 {
27 
30  class KRATOS_API(KRATOS_CORE) CodeLocation
31  {
32  public:
33 
34  CodeLocation();
35 
36  CodeLocation(CodeLocation&& rOther) noexcept = default;
37 
38  CodeLocation(CodeLocation const & Other) = default;
39 
40  CodeLocation(std::string const& FileName, std::string const& FunctionName, std::size_t LineNumber);
41 
45 
47  mFileName = Other.mFileName;
48  mFunctionName = Other.mFunctionName;
49  mLineNumber = Other.mLineNumber;
50 
51  return *this;
52  }
53 
54 
57 
59  std::string CleanFileName() const;
60 
62  std::string CleanFunctionName() const;
63 
64 
68 
69  const std::string& GetFileName() const;
70 
71  const std::string& GetFunctionName() const;
72 
73  int GetLineNumber() const;
74 
75 
77 
78  private:
81 
82  std::string mFileName;
83  std::string mFunctionName;
84  std::size_t mLineNumber;
85 
89 
90  static void RemoveNamespace(std::string& FunctionName, const std::string& Namespace);
91 
92  static void ReduceTemplateArgumentsToFirstN(std::string& FunctionName, const std::string& TemplateName, std::size_t NumberOfArgumentsToKeep);
93 
94  static std::size_t GetNextPositionSkippingWhiteSpaces(std::string const& ThisString, std::size_t Position);
95 
96  static bool IsWhiteSpace(char C);
97 
98  static void ReplaceAll(std::string& ThisString, const std::string& FromString, const std::string& ToString);
99 
101 
102  }; // Class CodeLocation
106 
108  std::ostream & operator <<(std::ostream& rOStream,
109  const CodeLocation& rThis);
111 
112 #if defined(KRATOS_CODE_LOCATION)
113 #undef KRATOS_CODE_LOCATION
114 #endif
115 
116 #if defined(KRATOS_CURRENT_FUNCTION)
117 #undef KRATOS_CURRENT_FUNCTION
118 #endif
119 
120 #if defined(__PRETTY_FUNCTION__)
121 #define KRATOS_CURRENT_FUNCTION __PRETTY_FUNCTION__
122 #elif defined(__GNUC__)
123 #define KRATOS_CURRENT_FUNCTION __PRETTY_FUNCTION__
124 #elif defined(__FUNCTION__)
125 #define KRATOS_CURRENT_FUNCTION __FUNCTION__
126 #elif defined(__func__)
127 #define KRATOS_CURRENT_FUNCTION __func__
128 #else
129 #define KRATOS_CURRENT_FUNCTION "unknown function"
130 #endif
131 
132 
133 #define KRATOS_CODE_LOCATION Kratos::CodeLocation(__FILE__, KRATOS_CURRENT_FUNCTION, __LINE__)
134 
135 
137 
138 } // namespace Kratos.
139 
140 #endif // KRATOS_CODE_LOCATION_H_INCLUDED defined
Definition: code_location.h:31
CodeLocation(CodeLocation const &Other)=default
CodeLocation & operator=(CodeLocation const &Other)
Definition: code_location.h:46
CodeLocation(CodeLocation &&rOther) noexcept=default
string FileName
Export to vtk.
Definition: GenerateWind.py:175
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
int C
Definition: generate_hyper_elastic_simo_taylor_neo_hookean.py:27