Memosa-FVM  0.2
GlobalFields Class Reference

#include <GlobalFields.h>

Public Types

typedef map< const FieldLabel
*, shared_ptr< Field > > 
FieldMap
 

Static Public Member Functions

static FieldcreateField (const FieldLabel &fieldLabel)
 
static const FieldgetField (const FieldLabel &fieldLabel)
 

Static Private Member Functions

static FieldMapgetFieldMap ()
 

Static Private Attributes

static FieldMap_fieldMap = 0
 

Detailed Description

Definition at line 12 of file GlobalFields.h.

Member Typedef Documentation

typedef map<const FieldLabel*, shared_ptr<Field> > GlobalFields::FieldMap

Definition at line 15 of file GlobalFields.h.

Member Function Documentation

Field & GlobalFields::createField ( const FieldLabel fieldLabel)
static

Definition at line 10 of file GlobalFields.cpp.

References getFieldMap(), and FieldLabel::getName().

11 {
12  FieldMap& fMap = getFieldMap();
13  FieldMap::iterator p = fMap.find(&fieldLabel);
14  if (p == fMap.end())
15  {
16  shared_ptr<Field> f(new Field(fieldLabel.getName()));
17  fMap[&fieldLabel] = f;
18  return *f;
19  }
20  else
21  return *p->second;
22 }
static FieldMap & getFieldMap()
Definition: Field.h:14
map< const FieldLabel *, shared_ptr< Field > > FieldMap
Definition: GlobalFields.h:15
const string & getName() const
Definition: FieldLabel.h:15
const Field & GlobalFields::getField ( const FieldLabel fieldLabel)
static

Definition at line 25 of file GlobalFields.cpp.

References getFieldMap(), and FieldLabel::getName().

26 {
27  FieldMap& fMap = getFieldMap();
28  FieldMap::iterator p = fMap.find(&fieldLabel);
29  if (p != fMap.end()) return *p->second;
30  throw CException("No such field " + fieldLabel.getName());
31 }
static FieldMap & getFieldMap()
map< const FieldLabel *, shared_ptr< Field > > FieldMap
Definition: GlobalFields.h:15
const string & getName() const
Definition: FieldLabel.h:15
GlobalFields::FieldMap & GlobalFields::getFieldMap ( )
staticprivate

Definition at line 34 of file GlobalFields.cpp.

References _fieldMap.

Referenced by createField(), and getField().

35 {
36  if (!_fieldMap)
37  {
38  _fieldMap = new FieldMap();
39  }
40  return *_fieldMap;
41 }
static FieldMap * _fieldMap
Definition: GlobalFields.h:22
map< const FieldLabel *, shared_ptr< Field > > FieldMap
Definition: GlobalFields.h:15

Member Data Documentation

GlobalFields::FieldMap * GlobalFields::_fieldMap = 0
staticprivate

Definition at line 22 of file GlobalFields.h.

Referenced by getFieldMap().


The documentation for this class was generated from the following files: