NuTo
Numerics Tool
Shape.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <iosfwd>
4 #include <Eigen/Core>
5 
6 namespace NuTo
7 {
8 
9 enum class eShape
10 {
11  Line,
12  Triangle,
15  Hexahedron,
16  Prism,
17  Pyramid
18 };
19 
20 class Shape
21 {
22 public:
23  virtual eShape Enum() const = 0;
24  virtual bool IsWithinShape(Eigen::VectorXd xi, double e = 1e-8) const = 0;
25  friend std::ostream& operator<<(std::ostream& out, const Shape& shape)
26  {
27  shape.Info(out);
28  return out;
29  }
30 protected:
31  virtual void Info(std::ostream& out) const = 0;
32 };
33 
34 inline bool operator==(const Shape& lhs, const Shape& rhs)
35 {
36  return lhs.Enum() == rhs.Enum();
37 }
38 
39 inline bool operator!=(const Shape& lhs, const Shape& rhs)
40 {
41  return !(lhs == rhs);
42 }
43 
44 
45 } // namespace NuTo
friend std::ostream & operator<<(std::ostream &out, const Shape &shape)
Definition: Shape.h:25
virtual void Info(std::ostream &out) const =0
eShape
Definition: Shape.h:9
Definition: Pyramid.h:8
Definition: Shape.h:20
Definition: Exception.h:6
rhs
Definition: SparseDirectSolverMKLDSS.py:46
virtual eShape Enum() const =0
bool operator==(const Shape &lhs, const Shape &rhs)
Definition: Shape.h:34
bool operator!=(const Shape &lhs, const Shape &rhs)
Definition: Shape.h:39