Itasca C++ Interface
ibody.h
1 #pragma once
2 // ibody.h
3 
4 // Interface for a Body which can be composed of multiple Pieces.
5 // Also properties.
6 // Other utility functions required by cell space.
7 
8 #include "dim.h"
9 namespace itasca {
10  class IFishParam;
11  class IGroup;
12  class IThing;
13 }
14 
15 namespace itascaxd {
16  using namespace itasca;
17  class IPiece;
18 
20  class IBody {
21  public:
23  inline static const TType type_ = 0x4c815b83;
24 
26  enum InOutMode { FullyOut=0, FullyIn, IntersectOut, IntersectIn, Surround};
27 
29  virtual IThing * getIThing()=0;
30  virtual const IThing * getIThing() const=0;
31 
33  virtual IPiece * getFirstPiece()=0;
34  virtual const IPiece * getFirstPiece() const=0;
36  virtual IThing * getFirstIThing()=0;
37  virtual const IThing * getFirstIThing() const=0;
39  virtual QStringList getAllAttributes() const =0;
41  virtual QVariant getAttribute(const QString &name) const = 0;
42 
43  // Return the extent of a body
44  virtual DExtent3 getExtent() const=0;
45  // Return a boolean indicating whether or not a box is completely inside the body
46  virtual bool isBoxIn(const DExtent &d,const double &tol=1e-7) const=0;
47  // Return a boolean indicating whether or not the body intersects a DExtent
48  virtual bool intersectsBox(const DExtent &d,const double &tol=1e-7) const=0;
49  // Return the in/out state
50  virtual InOutMode checkInOutSphere(const DVect &,const double &) const=0;
51 
52  virtual Quat getOrient() const=0;
53 
54  // Get/set the fragment index
55  virtual int getFragmentIndex() const=0;
56  virtual void setFragmentIndex(int ind)=0;
57 
58  // Reset the time step contributions
59  virtual void resetTimeStepContributions()=0;
60 
61  // Get the stress from the previous timestep
62  virtual void getOldStress(std::array<double,dimval(3,6)> &) const=0;
63  // Get the volume
64  virtual double getVolume() const=0;
65  // Returns true if any DOF is fixed
66  virtual bool getAnyFixed() const=0;
67  virtual bool getAllFixed() const=0;
68  virtual DVect getPosition() const=0;
69  virtual double getBodyConvergence() const=0;
70 
71  virtual std::vector<uint64> getSurfaceTriangles() const=0;
72 
73  };
74 } // namespace itascaxd
75 // EoF
3D quaternion utility class.
Definition: quat.h:109
Base class for items that will be stored in containers.
Definition: ithing.h:30
Definition: ibody.h:20
virtual IThing * getFirstIThing()=0
Get the first IThing - may be different than getFirstPiece.
virtual const IThing * getFirstIThing() const =0
Get the first piece.
virtual IPiece * getFirstPiece()=0
Get the first piece.
virtual QVariant getAttribute(const QString &name) const =0
Return the value of the attribute.
virtual QStringList getAllAttributes() const =0
Return a list of all the attribute names.
virtual const IThing * getIThing() const =0
Return IThing interface associated with this piece.
virtual const IPiece * getFirstPiece() const =0
Get the first piece.
virtual IThing * getIThing()=0
Return IThing interface associated with this piece.
InOutMode
Enumerator for defining the geometric attributes of a body relative to a geometric shape.
Definition: ibody.h:26
Definition: ipiece.h:15
DIM - Provides code portability between 2D and 3D codes.
uint32 TType
class type indicator
Definition: basedef.h:46
constexpr const U & dimval(const T &, const U &val3)
Returns the first argument in a 2D compile, and the second in a 3D compile.
Definition: dim.h:190
DExtent3 DExtent
A DExtent2 in 2D, a DExtent3 in 3D.
Definition: dim.h:156
DVect3 DVect
Vector of doubles, either 2D or 3D.
Definition: dim.h:150
namespace Itasca
Definition: basememory.cpp:10
Itasca Library standard namespace, specific to 2D or 3D.
Definition: icontactmodule.h:4