OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
inputrecord.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 inputrecord_h
36 #define inputrecord_h
37 
38 #include <vector>
39 #include <list>
40 #include <string>
41 
42 #include "logger.h" // for missing __func__ in MSC
43 #include "oofemcfg.h"
44 #include "irresulttype.h"
45 
46 namespace oofem {
47 class IntArray;
48 class FloatArray;
49 class FloatMatrix;
50 class Dictionary;
51 class Range;
53 
55 typedef const char *InputFieldType;
56 
60 #define IR_IOERR(__keyword, __ir, __result) \
61  __ir->report_error(this->giveClassName(), __func__, __keyword, __result, __FILE__, __LINE__);
62 
69 #define IR_GIVE_FIELD(__ir, __value, __id) result = __ir->giveField(__value, __id); \
70  if ( result != IRRT_OK ) { IR_IOERR(__id, __ir, result); }
71 
78 #define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id) result = __ir->giveOptionalField(__value, __id); \
79  if ( result != IRRT_OK ) { IR_IOERR(__id, __ir, result); }
80 
86 #define IR_GIVE_RECORD_KEYWORD_FIELD(__ir, __name, __value) \
87  result = __ir->giveRecordKeywordField(__name, __value); \
88  if ( result != IRRT_OK ) { IR_IOERR("RecordIDField", __ir, result); }
89 
90 
91 
101 class OOFEM_EXPORT InputRecord
102 {
103 public:
105  InputRecord();
107  InputRecord(const InputRecord &);
109  virtual ~InputRecord() { }
111  InputRecord &operator = ( const InputRecord & );
112 
114  virtual InputRecord *GiveCopy() = 0;
115 
117  virtual std :: string giveRecordAsString() const = 0;
118 
126  virtual IRResultType giveRecordKeywordField(std :: string &answer, int &value) = 0;
129  virtual IRResultType giveRecordKeywordField(std :: string &answer) = 0;
131  virtual IRResultType giveField(int &answer, InputFieldType id) = 0;
133  virtual IRResultType giveField(double &answer, InputFieldType id) = 0;
135  virtual IRResultType giveField(bool &answer, InputFieldType id) = 0;
137  virtual IRResultType giveField(std :: string &answer, InputFieldType id) = 0;
139  virtual IRResultType giveField(FloatArray &answer, InputFieldType id) = 0;
141  virtual IRResultType giveField(IntArray &answer, InputFieldType id) = 0;
143  virtual IRResultType giveField(FloatMatrix &answer, InputFieldType id) = 0;
145  virtual IRResultType giveField(std :: vector< std :: string > &answer, InputFieldType id) = 0;
147  virtual IRResultType giveField(Dictionary &answer, InputFieldType id) = 0;
149  virtual IRResultType giveField(std :: list< Range > &answer, InputFieldType id) = 0;
151  virtual IRResultType giveField(ScalarFunction &function, InputFieldType id) = 0;
153 
161  IRResultType giveOptionalField(int &answer, InputFieldType id);
164  IRResultType giveOptionalField(double &answer, InputFieldType id);
166  IRResultType giveOptionalField(bool &answer, InputFieldType id);
168  IRResultType giveOptionalField(std :: string &answer, InputFieldType id);
170  IRResultType giveOptionalField(FloatArray &answer, InputFieldType id);
172  IRResultType giveOptionalField(IntArray &answer, InputFieldType id);
174  IRResultType giveOptionalField(FloatMatrix &answer, InputFieldType id);
176  IRResultType giveOptionalField(std :: vector< std :: string > &answer, InputFieldType id);
178  IRResultType giveOptionalField(Dictionary &answer, InputFieldType id);
180  IRResultType giveOptionalField(std :: list< Range > &answer, InputFieldType id);
182  IRResultType giveOptionalField(ScalarFunction &function, InputFieldType id);
184 
186  virtual bool hasField(InputFieldType id) = 0;
187 
189  const char *strerror(IRResultType);
191  virtual void printYourself() = 0;
192 
194  virtual void report_error(const char *_class, const char *proc, InputFieldType id,
195  IRResultType result, const char *file, int line) = 0;
196 
198  virtual void finish(bool wrn = true) = 0;
199 };
200 } // end namespace oofem
201 #endif // inputrecord_h
virtual ~InputRecord()
Destructor.
Definition: inputrecord.h:109
const char * InputFieldType
Identifier of fields in input records.
Definition: inputrecord.h:52
Class implementing an array of integers.
Definition: intarray.h:61
This class implements a linked list whose entries are Pairs (see below).
Definition: dictionary.h:58
Class representing vector of real numbers.
Definition: floatarray.h:82
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
Implementation of Scalar function.
Class representing the general Input Record.
Definition: inputrecord.h:101
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:29 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011