OOFEM 3.0
Loading...
Searching...
No Matches
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 - 2025 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#include <unordered_map>
40
41#include "oofemenv.h"
42#include "error.h"
43
44namespace oofem {
54
55
57{
58public:
60 // two possible functions to call member function. virtual cause derived
61 // classes will use a pointer to an object and a pointer to a member function
62 // to make the function call
67 virtual int operator() (int, EntityRenumberingScheme) = 0;
69 virtual int call(int, EntityRenumberingScheme) = 0;
70};
71
73template< class TClass > class SpecificEntityRenumberingFunctor : public EntityRenumberingFunctor
74{
75private:
77 int ( TClass :: *fpt )(int, EntityRenumberingScheme);
79 TClass *pt2Object;
80
81public:
82
83 // constructor - takes pointer to an object and pointer to a member and stores
84 // them in two private variables
85 SpecificEntityRenumberingFunctor( TClass * _pt2Object, int ( TClass :: *_fpt )(int, EntityRenumberingScheme) )
86 {
87 pt2Object = _pt2Object;
88 fpt = _fpt;
89 };
90
91 virtual int operator() (int n, EntityRenumberingScheme ers)
92 {
93 return ( * pt2Object.*fpt )(n, ers);
94 };
95
96 virtual int call(int n, EntityRenumberingScheme ers)
97 { return ( * pt2Object.*fpt )(n, ers); };
98};
99
100
103{
104private:
105 std :: unordered_map< int, int > &dofmanMap, &elemMap;
106
107public:
108 MapBasedEntityRenumberingFunctor(std :: unordered_map< int, int > & _dofmanMap, std :: unordered_map< int, int > & _elemMap) :
109 dofmanMap(_dofmanMap), elemMap(_elemMap)
110 { }
111
112 int operator() (int n, EntityRenumberingScheme ers) override
113 {
114 if ( ers == ERS_DofManager ) {
115 auto pos = dofmanMap.find(n);
116 if (pos != dofmanMap.end()) {
117 return pos->second;
118 }
119 } else if ( ers == ERS_Element ) {
120 auto pos = elemMap.find(n);
121 if ( pos != elemMap.end() ) {
122 return pos->second;
123 }
124 } else {
125 OOFEM_ERROR("unsupported EntityRenumberingScheme");
126 }
127 throw std::out_of_range("entry not found");
128 //OOFEM_ERROR("component label %d not found", n);
129 }
130
131 int call(int n, EntityRenumberingScheme ers) override
132 { return this->operator() (n, ers); };
133};
134} // end namespace oofem
135#endif // entityrenumberingscheme_h
virtual int call(int, EntityRenumberingScheme)=0
Call using function.
std ::unordered_map< int, int > & dofmanMap
std ::unordered_map< int, int > & elemMap
int call(int n, EntityRenumberingScheme ers) override
Call using function.
MapBasedEntityRenumberingFunctor(std ::unordered_map< int, int > &_dofmanMap, std ::unordered_map< int, int > &_elemMap)
int(TClass ::* fpt)(int, EntityRenumberingScheme)
Pointer to member function.
virtual int call(int n, EntityRenumberingScheme ers)
Call using function.
virtual int operator()(int n, EntityRenumberingScheme ers)
SpecificEntityRenumberingFunctor(TClass *_pt2Object, int(TClass ::*_fpt)(int, EntityRenumberingScheme))
#define OOFEM_ERROR(...)
Definition error.h:79
#define OOFEM_EXPORT
Definition oofemcfg.h:7

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011