OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
domaintransactionmanager.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 
36 #include "error.h"
37 #include "dofmanager.h"
38 #include "element.h"
39 #include "domain.h"
40 
41 namespace oofem {
43 {
44  this->domain = d;
45 }
46 
48 {
49  if ( !( dofmanTransactions.empty() && elementTransactions.empty() ) ) {
50  OOFEM_WARNING("uncommited transactions exist");
51  }
52 }
53 
54 void
56 { }
57 
58 int
60 {
61  if ( dtt == DTT_Remove ) {
62  obj = NULL;
63  }
64 
65  if ( dofmanTransactions.find(label) != dofmanTransactions.end() ) {
66  // local enry exist
67  // delete previous record
68  if ( dofmanTransactions [ label ] ) {
69  delete dofmanTransactions [ label ];
70  }
71  }
72 
73  // set new record
74  dofmanTransactions [ label ] = obj;
75 
76  return 1;
77 }
78 
79 int
81 {
82  if ( dtt == DTT_Remove ) {
83  obj = NULL;
84  }
85 
86  if ( elementTransactions.find(label) != elementTransactions.end() ) {
87  // local enry exist
88  // delete previous record
89  if ( elementTransactions [ label ] ) {
90  delete elementTransactions [ label ];
91  }
92  }
93 
94  // set new record
95  elementTransactions [ label ] = obj;
96 
97  return 1;
98 }
99 
100 
102 {
103  if ( dofmanTransactions.find(label) != dofmanTransactions.end() ) {
104  // if modified record exist return it
105  return dofmanTransactions [ label ];
106  } else {
107  // no modification recorded -> return NULL
108  return NULL;
109  }
110 }
111 
112 
114 {
115  if ( elementTransactions.find(label) != elementTransactions.end() ) {
116  // if modified record exist return it
117  return elementTransactions [ label ];
118  } else {
119  // no modification recorded -> return NULL
120  return NULL;
121  }
122 }
123 
124 
125 int
127 {
128  return domain->commitTransactions(this);
129 }
130 } // end namespace oofem
int addDofManTransaction(DomainTransactionType, int, DofManager *)
Class and object Domain.
Definition: domain.h:115
int addElementTransaction(DomainTransactionType, int, Element *)
int commitTransactions(DomainTransactionManager *tm)
Commits transactions recorded in transaction manager.
Definition: domain.C:1619
Abstract base class for all finite elements.
Definition: element.h:145
Base class for dof managers.
Definition: dofmanager.h:113
std::map< int, DofManager * > dofmanTransactions
std::map< int, Element * > elementTransactions
the oofem namespace is to define a context or scope in which all oofem names are defined.
#define OOFEM_WARNING(...)
Definition: error.h:62

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