MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
grad::LocalDofMap Class Reference

#include <gradient.h>

Collaboration diagram for grad::LocalDofMap:

Public Types

typedef std::vector
< index_type,
GradientAllocator< index_type > > 
VectorType
 
typedef VectorType::size_type size_type
 
typedef VectorType::const_iterator LocalIterator
 
typedef std::map< index_type,
index_type, std::less
< index_type >
, GradientAllocator< std::pair
< index_type, index_type > > > 
MapType
 
typedef MapType::const_iterator GlobalIterator
 

Public Member Functions

 LocalDofMap (index_type iMaxSize=0)
 
index_type iGetGlobalDof (index_type iLocal) const
 
index_type iGetLocalIndex (index_type iGlobal) const
 
index_type AllocateLocalDof (index_type iGlobal)
 
void Reset (enum FunctionCall func=UNKNOWN_FUNC)
 
enum FunctionCall GetLastCall () const
 
LocalIterator BeginLocal () const
 
LocalIterator EndLocal () const
 
GlobalIterator BeginGlobal () const
 
GlobalIterator EndGlobal () const
 
index_type Size () const
 

Static Public Attributes

static const index_type INVALID_INDEX = -1
 

Private Attributes

VectorType oLocalToGlobal
 
MapType oGlobalToLocal
 
enum FunctionCall eLastCall
 

Detailed Description

Definition at line 1040 of file gradient.h.

Member Typedef Documentation

typedef MapType::const_iterator grad::LocalDofMap::GlobalIterator

Definition at line 1050 of file gradient.h.

typedef VectorType::const_iterator grad::LocalDofMap::LocalIterator

Definition at line 1044 of file gradient.h.

Definition at line 1049 of file gradient.h.

typedef VectorType::size_type grad::LocalDofMap::size_type

Definition at line 1043 of file gradient.h.

Constructor & Destructor Documentation

grad::LocalDofMap::LocalDofMap ( index_type  iMaxSize = 0)
inlineexplicit

Definition at line 1053 of file gradient.h.

References oLocalToGlobal.

1055 
1056  if (iMaxSize > 0) {
1057  oLocalToGlobal.reserve(iMaxSize);
1058  }
1059  }
VectorType oLocalToGlobal
Definition: gradient.h:1134
enum FunctionCall eLastCall
Definition: gradient.h:1136

Member Function Documentation

index_type grad::LocalDofMap::AllocateLocalDof ( index_type  iGlobal)
inline

Definition at line 1091 of file gradient.h.

References GRADIENT_ASSERT, oGlobalToLocal, and oLocalToGlobal.

Referenced by grad::Gradient< N_SIZE >::Copy(), and grad::MapVector< N_SIZE >::ResizeReset().

1091  {
1092  MapType::const_iterator i = oGlobalToLocal.find(iGlobal);
1093 
1094  if (i != oGlobalToLocal.end()) {
1095  GRADIENT_ASSERT(i->first == iGlobal);
1096  return i->second;
1097  }
1098 
1099  index_type iLocal = oLocalToGlobal.size();
1100  oLocalToGlobal.push_back(iGlobal);
1101  oGlobalToLocal[iGlobal] = iLocal;
1102 
1103  GRADIENT_ASSERT(oGlobalToLocal[iGlobal] == iLocal);
1104  GRADIENT_ASSERT(oLocalToGlobal[iLocal] == iGlobal);
1105  GRADIENT_ASSERT(oLocalToGlobal.size() == oGlobalToLocal.size());
1106 
1107  return iLocal;
1108  }
MapType oGlobalToLocal
Definition: gradient.h:1135
VectorType oLocalToGlobal
Definition: gradient.h:1134
integer index_type
Definition: gradient.h:104
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74
GlobalIterator grad::LocalDofMap::BeginGlobal ( ) const
inline

Definition at line 1126 of file gradient.h.

References oGlobalToLocal.

Referenced by grad::operator<<().

1126 { return oGlobalToLocal.begin(); }
MapType oGlobalToLocal
Definition: gradient.h:1135
LocalIterator grad::LocalDofMap::BeginLocal ( ) const
inline

Definition at line 1124 of file gradient.h.

References oLocalToGlobal.

Referenced by grad::operator<<().

1124 { return oLocalToGlobal.begin(); }
VectorType oLocalToGlobal
Definition: gradient.h:1134
GlobalIterator grad::LocalDofMap::EndGlobal ( ) const
inline

Definition at line 1127 of file gradient.h.

References oGlobalToLocal.

Referenced by grad::operator<<().

1127 { return oGlobalToLocal.end(); }
MapType oGlobalToLocal
Definition: gradient.h:1135
LocalIterator grad::LocalDofMap::EndLocal ( ) const
inline

Definition at line 1125 of file gradient.h.

References oLocalToGlobal.

Referenced by grad::operator<<().

1125 { return oLocalToGlobal.end(); }
VectorType oLocalToGlobal
Definition: gradient.h:1134
enum FunctionCall grad::LocalDofMap::GetLastCall ( ) const
inline

Definition at line 1122 of file gradient.h.

References eLastCall.

1122 { return eLastCall; }
enum FunctionCall eLastCall
Definition: gradient.h:1136
index_type grad::LocalDofMap::iGetGlobalDof ( index_type  iLocal) const
inline

Definition at line 1061 of file gradient.h.

References GRADIENT_ASSERT, oGlobalToLocal, and oLocalToGlobal.

Referenced by grad::Gradient< N_SIZE >::ApplyBinaryFunctionNoAlias(), grad::Gradient< N_SIZE >::Copy(), grad::MapVector< N_SIZE >::iGetGlobalDof(), and testMapVector().

1061  {
1062  GRADIENT_ASSERT(iLocal >= 0);
1063  GRADIENT_ASSERT(size_type(iLocal) < oLocalToGlobal.size());
1064 
1065  index_type iGlobal = oLocalToGlobal[iLocal];
1066 
1067  GRADIENT_ASSERT(oGlobalToLocal.find(iGlobal)->second == iLocal);
1068  GRADIENT_ASSERT(oLocalToGlobal[iLocal] == iGlobal);
1069  GRADIENT_ASSERT(oLocalToGlobal.size() == oGlobalToLocal.size());
1070 
1071  return iGlobal;
1072  }
MapType oGlobalToLocal
Definition: gradient.h:1135
VectorType oLocalToGlobal
Definition: gradient.h:1134
integer index_type
Definition: gradient.h:104
VectorType::size_type size_type
Definition: gradient.h:1043
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74
index_type grad::LocalDofMap::iGetLocalIndex ( index_type  iGlobal) const
inline

Definition at line 1074 of file gradient.h.

References GRADIENT_ASSERT, INVALID_INDEX, oGlobalToLocal, and oLocalToGlobal.

Referenced by grad::Gradient< N_SIZE >::ApplyBinaryFunctionNoAlias(), grad::Gradient< N_SIZE >::Copy(), grad::MapVector< N_SIZE >::dGetGlobalVector(), and grad::MapVector< N_SIZE >::SetGlobalVector().

1074  {
1075  MapType::const_iterator i = oGlobalToLocal.find(iGlobal);
1076 
1077  if (i == oGlobalToLocal.end()) {
1078  return INVALID_INDEX;
1079  }
1080 
1081  index_type iLocal = i->second;
1082 
1083  GRADIENT_ASSERT(iLocal >= 0);
1084  GRADIENT_ASSERT(size_type(iLocal) < oLocalToGlobal.size());
1085  GRADIENT_ASSERT(oLocalToGlobal[iLocal] == iGlobal);
1086  GRADIENT_ASSERT(oLocalToGlobal.size() == oGlobalToLocal.size());
1087 
1088  return iLocal;
1089  }
MapType oGlobalToLocal
Definition: gradient.h:1135
VectorType oLocalToGlobal
Definition: gradient.h:1134
integer index_type
Definition: gradient.h:104
VectorType::size_type size_type
Definition: gradient.h:1043
static const index_type INVALID_INDEX
Definition: gradient.h:1051
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74
void grad::LocalDofMap::Reset ( enum FunctionCall  func = UNKNOWN_FUNC)
inline

Definition at line 1110 of file gradient.h.

References eLastCall, func(), oGlobalToLocal, oLocalToGlobal, grad::STATE_MASK, and grad::UNKNOWN_FUNC.

Referenced by grad::GradientAssVec< Gradient< N_SIZE > >::AssJac(), and grad::GradientAssVec< Gradient< N_SIZE > >::InitialAssJac().

1110  {
1111  bool bReset = (func & STATE_MASK) != (eLastCall & STATE_MASK)
1112  || func == UNKNOWN_FUNC;
1113 
1114  eLastCall = func;
1115 
1116  if (bReset) {
1117  oLocalToGlobal.clear();
1118  oGlobalToLocal.clear();
1119  }
1120  }
MapType oGlobalToLocal
Definition: gradient.h:1135
VectorType oLocalToGlobal
Definition: gradient.h:1134
void func(const T &u, const T &v, const T &w, doublereal e, T &f)
enum FunctionCall eLastCall
Definition: gradient.h:1136

Here is the call graph for this function:

index_type grad::LocalDofMap::Size ( ) const
inline

Definition at line 1128 of file gradient.h.

References GRADIENT_ASSERT, oGlobalToLocal, and oLocalToGlobal.

Referenced by testMapVector().

1128  {
1129  GRADIENT_ASSERT(oGlobalToLocal.size() == oLocalToGlobal.size());
1130  return oLocalToGlobal.size();
1131  }
MapType oGlobalToLocal
Definition: gradient.h:1135
VectorType oLocalToGlobal
Definition: gradient.h:1134
#define GRADIENT_ASSERT(expr)
Definition: gradient.h:74

Member Data Documentation

enum FunctionCall grad::LocalDofMap::eLastCall
private

Definition at line 1136 of file gradient.h.

Referenced by GetLastCall(), and Reset().

MapType grad::LocalDofMap::oGlobalToLocal
private
VectorType grad::LocalDofMap::oLocalToGlobal
private

The documentation for this class was generated from the following file: