OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
fieldmanager.C
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 #include "fieldmanager.h"
36 
37 namespace oofem {
39 { }
40 
41 void
42 FieldManager :: registerField(std :: shared_ptr< Field >eField, FieldType key)
43 {
44  if (this->externalFields.find(key) == this->externalFields.end()) {
45  this->externalFields.insert({key, eField});
46  } else {
47  this->externalFields.at(key)=eField;
48  }
51 }
52 
53 
54 
55 
56 bool
58 {
59  return ( this->externalFields.find(key) != this->externalFields.end() );
60 }
61 
62 std :: shared_ptr< Field >
64 {
65  auto i = this->externalFields.find(key);
66  if ( i == this->externalFields.end() ) {
67  std :: shared_ptr< Field >p; // std::shared_ptr<Field> p(nullptr);
68  return p;
69  }
70 
71  return i->second;
72 }
73 
74 void
76 {
77  auto i = this->externalFields.find(key);
78  if ( i == this->externalFields.end() ) {
79  return;
80  }
81 
82  this->externalFields.erase(i);
83 }
84 
85 std::vector<FieldType>
87 {
88  std::vector<FieldType> ret;
89  for(const auto& keyField: this->externalFields) ret.push_back(keyField.first);
90  return ret;
91 }
92 
93 } // end namespace oofem
FieldType
Physical type of field.
Definition: field.h:60
void unregisterField(FieldType key)
Unregisters (deletes) the field registered under given key.
Definition: fieldmanager.C:75
std::map< FieldType, std::shared_ptr< Field > > externalFields
Field container.
Definition: fieldmanager.h:58
FieldPtr giveField(FieldType key)
Returns the previously registered field under given key; NULL otherwise.
Definition: fieldmanager.C:63
void registerField(FieldPtr eField, FieldType key)
Registers the given field (the receiver is not assumed to own given field).
Definition: fieldmanager.C:42
std::vector< FieldType > giveRegisteredKeys()
Returns list of registered field keys, which can be obtained by calling giveField.
Definition: fieldmanager.C:86
the oofem namespace is to define a context or scope in which all oofem names are defined.
bool isFieldRegistered(FieldType key)
Returns true if field is registered under key.
Definition: fieldmanager.C:57

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