IFEM  90A354
LocalIntegral.h
Go to the documentation of this file.
1 // $Id$
2 //==============================================================================
12 //==============================================================================
13 
14 #ifndef _LOCAL_INTEGRAL_H
15 #define _LOCAL_INTEGRAL_H
16 
17 #include "MatVec.h"
18 
19 
25 {
26 protected:
29 
30 public:
32  virtual ~LocalIntegral() {}
34  virtual void destruct() { delete this; }
36  virtual const LocalIntegral* ref() const { return this; }
37 
54  void getSolution(size_t nsd, size_t nen, Matrix* u = nullptr,
55  Matrix* v = nullptr, Matrix* a = nullptr,
56  bool forceCurrent = false) const
57  {
58  int nvec = vec.size();
59  if (nvec > 5 && forceCurrent) nvec = 3;
60  int idis = nvec > 5 ? 3 : 0; // index to element displacement vector (u)
61  if (nvec == 2 && !forceCurrent) idis = 1; // probably a quasi-static problem
62  int ivel = idis + 1; // index to element velocity vector (v)
63  int iacc = ivel + 1; // index to element acceleration vector (a)
64  if (u && idis < nvec) u->fill(vec[idis],nsd,nen);
65  if (v && ivel < nvec) v->fill(vec[ivel],nsd,nen);
66  if (a && iacc < nvec) a->fill(vec[iacc],nsd,nen);
67  }
68 
70 };
71 
72 #endif
Global algebraic operations on index 1-based matrices and vectors.
std::vector< Vector > Vectors
An array of real-valued vectors with algebraic operations.
Definition: MatVec.h:37
Abstract base class representing an element level integrated quantity.
Definition: LocalIntegral.h:25
Vectors vec
Element-level primary solution vectors.
Definition: LocalIntegral.h:69
LocalIntegral()
The default constructor is protected to allow sub-classes only.
Definition: LocalIntegral.h:28
virtual void destruct()
Virtual destruction method to clean up after numerical integration.
Definition: LocalIntegral.h:34
virtual ~LocalIntegral()
Empty destructor.
Definition: LocalIntegral.h:32
virtual const LocalIntegral * ref() const
Returns the LocalIntegral object to assemble into the global one.
Definition: LocalIntegral.h:36
void getSolution(size_t nsd, size_t nen, Matrix *u=nullptr, Matrix *v=nullptr, Matrix *a=nullptr, bool forceCurrent=false) const
Extracts element solution vectors as nsd by nen matrices.
Definition: LocalIntegral.h:54