OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
entityrenumberingscheme.h
Go to the documentation of this file.
1 /*
2  *
3  * ##### ##### ###### ###### ### ###
4  * ## ## ## ## ## ## ## ### ##
5  * ## ## ## ## #### #### ## # ##
6  * ## ## ## ## ## ## ## ##
7  * ## ## ## ## ## ## ## ##
8  * ##### ##### ## ###### ## ##
9  *
10  *
11  * OOFEM : Object Oriented Finite Element Code
12  *
13  * Copyright (C) 1993 - 2013 Borek Patzak
14  *
15  *
16  *
17  * Czech Technical University, Faculty of Civil Engineering,
18  * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19  *
20  * This library is free software; you can redistribute it and/or
21  * modify it under the terms of the GNU Lesser General Public
22  * License as published by the Free Software Foundation; either
23  * version 2.1 of the License, or (at your option) any later version.
24  *
25  * This program is distributed in the hope that it will be useful,
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28  * Lesser General Public License for more details.
29  *
30  * You should have received a copy of the GNU Lesser General Public
31  * License along with this library; if not, write to the Free Software
32  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33  */
34 
35 #ifndef entityrenumberingscheme_h
36 #define entityrenumberingscheme_h
37 
38 #include <map>
39 
40 #include "oofemcfg.h"
41 #include "error.h"
42 
43 namespace oofem {
52 };
53 
54 
55 class OOFEM_EXPORT EntityRenumberingFunctor
56 {
57 public:
59  // two possible functions to call member function. virtual cause derived
60  // classes will use a pointer to an object and a pointer to a member function
61  // to make the function call
63  virtual int operator() (int, EntityRenumberingScheme) = 0;
65  virtual int call(int, EntityRenumberingScheme) = 0;
66 };
67 
69 template< class TClass > class SpecificEntityRenumberingFunctor : public EntityRenumberingFunctor
70 {
71 private:
73  int ( TClass :: *fpt )(int, EntityRenumberingScheme);
75  TClass *pt2Object;
76 
77 public:
78 
79  // constructor - takes pointer to an object and pointer to a member and stores
80  // them in two private variables
81  SpecificEntityRenumberingFunctor( TClass * _pt2Object, int ( TClass :: *_fpt )(int, EntityRenumberingScheme) )
82  {
83  pt2Object = _pt2Object;
84  fpt = _fpt;
85  };
86 
87  virtual int operator() (int n, EntityRenumberingScheme ers)
88  {
89  return ( * pt2Object.*fpt )(n, ers);
90  };
91 
92  virtual int call(int n, EntityRenumberingScheme ers)
93  { return ( * pt2Object.*fpt )(n, ers); };
94 };
95 
96 
99 {
100 private:
101  std :: map< int, int > &dofmanMap, &elemMap;
102 
103 public:
104  MapBasedEntityRenumberingFunctor(std :: map< int, int > & _dofmanMap, std :: map< int, int > & _elemMap) :
105  dofmanMap(_dofmanMap), elemMap(_elemMap)
106  { }
107 
108  virtual int operator() (int n, EntityRenumberingScheme ers)
109  {
110  std :: map< int, int > :: const_iterator it;
111  if ( ers == ERS_DofManager ) {
112  if ( ( it = dofmanMap.find(n) ) != dofmanMap.end() ) {
113  return it->second;
114  }
115  } else if ( ers == ERS_Element ) {
116  if ( ( it = elemMap.find(n) ) != elemMap.end() ) {
117  return it->second;
118  }
119  } else {
120  OOFEM_ERROR("unsupported EntityRenumberingScheme");
121  }
122 
123  OOFEM_ERROR("component label %d not found", n);
124  return 0;
125  }
126 
127  virtual int call(int n, EntityRenumberingScheme ers)
128  { return this->operator() (n, ers); };
129 };
130 } // end namespace oofem
131 #endif // entityrenumberingscheme_h
SpecificEntityRenumberingFunctor(TClass *_pt2Object, int(TClass::*_fpt)(int, EntityRenumberingScheme))
MapBasedEntityRenumberingFunctor(std::map< int, int > &_dofmanMap, std::map< int, int > &_elemMap)
EntityRenumberingScheme
Type allowing to specify the required renumbering scheme; One can have a renumbering scheme for dof m...
#define OOFEM_ERROR(...)
Definition: error.h:61
virtual int call(int n, EntityRenumberingScheme ers)
Call using function.
virtual int call(int n, EntityRenumberingScheme ers)
Call using function.
Renumbering functor based on provided maps.
the oofem namespace is to define a context or scope in which all oofem names are defined.

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:28 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011