Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
1b9ae829
Commit
1b9ae829
authored
Mar 04, 2009
by
Andrew Heather
Browse files
streamlined input for DataEntry
parent
3b07525b
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/Constant.C
View file @
1b9ae829
...
...
@@ -29,38 +29,26 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
<
class
Type
>
Foam
::
Constant
<
Type
>::
Constant
(
const
word
&
entryName
,
const
dictionary
&
dict
)
Foam
::
Constant
<
Type
>::
Constant
(
const
word
&
entryName
,
Istream
&
is
)
:
DataEntry
<
Type
>
(
typeName
,
entryName
,
dict
),
value_
(
this
->
dict_
.
lookup
(
"value"
)
)
DataEntry
<
Type
>
(
entryName
),
value_
(
is
)
{}
template
<>
Foam
::
Constant
<
Foam
::
label
>::
Constant
(
const
word
&
entryName
,
const
dictionary
&
dict
)
Foam
::
Constant
<
Foam
::
label
>::
Constant
(
const
word
&
entryName
,
Istream
&
is
)
:
DataEntry
<
label
>
(
typeName
,
entryName
,
dict
),
value_
(
readLabel
(
this
->
dict_
.
lookup
(
"value"
)
))
DataEntry
<
label
>
(
entryName
),
value_
(
readLabel
(
is
))
{}
template
<>
Foam
::
Constant
<
Foam
::
scalar
>::
Constant
(
const
word
&
entryName
,
const
dictionary
&
dict
)
Foam
::
Constant
<
Foam
::
scalar
>::
Constant
(
const
word
&
entryName
,
Istream
&
is
)
:
DataEntry
<
scalar
>
(
typeName
,
entryName
,
dict
),
value_
(
readScalar
(
this
->
dict_
.
lookup
(
"value"
)
))
DataEntry
<
scalar
>
(
entryName
),
value_
(
readScalar
(
is
))
{}
...
...
src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/Constant.H
View file @
1b9ae829
...
...
@@ -28,12 +28,9 @@ Class
Description
Templated basic entry that holds a constant value.
Usage - for entry <entryName> having the value <value>:
@verbatim
entry Constant
entryCoeffs
{
value 100.0; // Constant value
}
<entryName> constant <value>
@endverbatim
SourceFiles
...
...
@@ -78,17 +75,13 @@ class Constant
public:
// Runtime type information
TypeName
(
"
C
onstant"
);
TypeName
(
"
c
onstant"
);
// Constructors
//- Construct from dictionary
Constant
(
const
word
&
entryName
,
const
dictionary
&
dict
);
//- Construct from entry name and Istream
Constant
(
const
word
&
entryName
,
Istream
&
is
);
//- Destructor
...
...
@@ -108,10 +101,10 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template
<
>
Constant
<
label
>::
Constant
(
const
word
&
entryName
,
const
dictionary
&
dict
);
Constant
<
label
>::
Constant
(
const
word
&
entryName
,
Istream
&
is
);
template
<
>
Constant
<
scalar
>::
Constant
(
const
word
&
entryName
,
const
dictionary
&
dict
);
Constant
<
scalar
>::
Constant
(
const
word
&
entryName
,
Istream
&
is
);
}
// End namespace Foam
...
...
src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntry.C
View file @
1b9ae829
...
...
@@ -29,15 +29,9 @@ License
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
template
<
class
Type
>
Foam
::
DataEntry
<
Type
>::
DataEntry
(
const
word
&
typeName
,
const
word
&
entryName
,
const
dictionary
&
dict
)
Foam
::
DataEntry
<
Type
>::
DataEntry
(
const
word
&
entryName
)
:
dict_
(
dict
.
subDict
(
entryName
+
"Coeffs"
)),
entry_
(
entryName
)
name_
(
entryName
)
{}
...
...
@@ -51,9 +45,9 @@ Foam::DataEntry<Type>::~DataEntry()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
<
class
Type
>
const
Foam
::
dictionary
&
Foam
::
DataEntry
<
Type
>::
dict
()
const
const
Foam
::
word
&
Foam
::
DataEntry
<
Type
>::
name
()
const
{
return
dict
_
;
return
name
_
;
}
...
...
src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntry.H
View file @
1b9ae829
...
...
@@ -48,7 +48,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class DataEntry Declaration
Class DataEntry Declaration
\*---------------------------------------------------------------------------*/
template
<
class
Type
>
...
...
@@ -67,11 +67,8 @@ protected:
// Protected data
//- Coefficients dictionary
const
dictionary
dict_
;
//- Name of entry
const
word
entry
_
;
const
word
name
_
;
public:
...
...
@@ -87,21 +84,16 @@ public:
dictionary
,
(
const
word
&
entryName
,
const
dictionary
&
dict
Istream
&
is
),
(
entryName
,
dict
)
(
entryName
,
is
)
);
// Constructor
//- Construct from type name and dictionary
DataEntry
(
const
word
&
TypeName
,
const
word
&
entryName
,
const
dictionary
&
dict
);
//- Construct from entry name
DataEntry
(
const
word
&
entryName
);
//- Selector
...
...
@@ -120,8 +112,8 @@ public:
// Access
//- Return the
dictiona
ry
const
dictionary
&
dict
()
const
;
//- Return the
name of the ent
ry
const
word
&
name
()
const
;
// Evaluation
...
...
src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/NewDataEntry.C
View file @
1b9ae829
...
...
@@ -35,27 +35,24 @@ Foam::autoPtr<Foam::DataEntry<Type> > Foam::DataEntry<Type>::New
const
dictionary
&
dict
)
{
word
DataEntryType
(
dict
.
lookup
(
entryName
));
Istream
&
is
(
dict
.
lookup
(
entryName
));
// Info<< "Selecting DataEntry " <<
DataEntryType
<< endl
;
word
DataEntryType
(
is
)
;
typename
dictionaryConstructorTable
::
iterator
cstrIter
=
dictionaryConstructorTablePtr_
->
find
(
DataEntryType
);
if
(
cstrIter
==
dictionaryConstructorTablePtr_
->
end
())
{
FatalErrorIn
(
"DataEntry<Type>::New(const dictionary&"
)
<<
"Unknown DataEntry type "
<<
DataEntryType
<<
" for "
<<
entryName
<<
", constructor not in hash table"
<<
nl
<<
nl
FatalErrorIn
(
"DataEntry<Type>::New(Istream&)"
)
<<
"Unknown DataEntry type "
<<
DataEntryType
<<
" for DataEntry "
<<
entryName
<<
". Constructor not in hash table"
<<
nl
<<
nl
<<
" Valid DataEntry types are :"
<<
nl
<<
dictionaryConstructorTablePtr_
->
toc
()
<<
nl
<<
exit
(
FatalError
);
}
return
autoPtr
<
DataEntry
<
Type
>
>
(
cstrIter
()(
entryName
,
dict
));
return
autoPtr
<
DataEntry
<
Type
>
>
(
cstrIter
()(
entryName
,
is
));
}
...
...
src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.C
View file @
1b9ae829
...
...
@@ -29,26 +29,16 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
<
class
Type
>
Foam
::
Table
<
Type
>::
Table
(
const
word
&
entryName
,
const
dictionary
&
dict
)
Foam
::
Table
<
Type
>::
Table
(
const
word
&
entryName
,
Istream
&
is
)
:
DataEntry
<
Type
>
(
typeName
,
entryName
,
dict
),
table_
(
this
->
dict_
.
lookup
(
"table"
)
)
DataEntry
<
Type
>
(
entryName
),
table_
(
is
)
{
if
(
!
table_
.
size
())
{
FatalErrorIn
(
"Foam::Table<Type>::Table
\n
"
"(
\n
"
" const word& entryName,
\n
"
" const dictionary& dict
\n
"
")
\n
"
)
<<
"Table is invalid (empty)"
<<
nl
<<
exit
(
FatalError
);
FatalErrorIn
(
"Foam::Table<Type>::Table(const Istream&)"
)
<<
"Table for entry "
<<
this
->
name_
<<
" is invalid (empty)"
<<
nl
<<
exit
(
FatalError
);
}
}
...
...
src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.H
View file @
1b9ae829
...
...
@@ -28,18 +28,14 @@ Class
Description
Templated table container data entry. Items are stored in a list of
Tuple2's. First column is always stored as scalar entries. Data is read
in the form, e.g. for (scalar, vector):
in the form, e.g. for
an entry <entryName> that is
(scalar, vector):
@verbatim
entry Table
entryCoeffs
{
table
(
0.0 (1 2 3)
1.0 (4 5 6)
)
}
<entryName> table
(
0.0 (1 2 3)
1.0 (4 5 6)
);
@endverbatim
SourceFiles
...
...
@@ -85,13 +81,13 @@ class Table
public:
//- Runtime type information
TypeName
(
"
T
able"
);
TypeName
(
"
t
able"
);
// Constructors
//- Construct from
dictionary
Table
(
const
word
&
entryName
,
const
dictionary
&
dict
);
//- Construct from
entry name and Istream
Table
(
const
word
&
entryName
,
Istream
&
is
);
//- Destructor
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment