Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
d73ae169
Commit
d73ae169
authored
Jan 03, 2013
by
mattijs
Browse files
ENH: debug: register multiple variables with same name
parent
339844e1
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/containers/Dictionaries/Dictionary/Dictionary.C
View file @
d73ae169
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2013
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -28,7 +28,9 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
<
class
T
>
Foam
::
Dictionary
<
T
>::
Dictionary
()
Foam
::
Dictionary
<
T
>::
Dictionary
(
const
label
size
)
:
DictionaryBase
<
IDLList
<
T
>
,
T
>
(
size
)
{}
...
...
src/OpenFOAM/containers/Dictionaries/Dictionary/Dictionary.H
View file @
d73ae169
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2013
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -61,8 +61,8 @@ public:
// Constructors
//-
Null c
onstruct
or
Dictionary
();
//-
C
onstruct
given initial table size
Dictionary
(
const
label
size
=
128
);
//- Copy construct
Dictionary
(
const
Dictionary
&
);
...
...
src/OpenFOAM/db/Time/TimeIO.C
View file @
d73ae169
...
...
@@ -55,22 +55,30 @@ void Foam::Time::readDict()
{
const
word
&
name
=
iter
().
keyword
();
simple
RegIOobject
*
objPtr
=
objects
.
lookupPtr
(
name
);
simple
ObjectRegistryEntry
*
objPtr
=
objects
.
lookupPtr
(
name
);
if
(
objPtr
)
{
Info
<<
" "
<<
iter
()
<<
endl
;
const
List
<
simpleRegIOobject
*>&
objects
=
*
objPtr
;
if
(
iter
().
isDict
())
{
OStringStream
os
(
IOstream
::
ASCII
);
os
<<
iter
().
dict
();
IStringStream
is
(
os
.
str
());
objPtr
->
readData
(
is
);
forAll
(
objects
,
i
)
{
OStringStream
os
(
IOstream
::
ASCII
);
os
<<
iter
().
dict
();
IStringStream
is
(
os
.
str
());
objects
[
i
]
->
readData
(
is
);
}
}
else
{
objPtr
->
readData
(
iter
().
stream
());
forAll
(
objects
,
i
)
{
objects
[
i
]
->
readData
(
iter
().
stream
());
}
}
}
}
...
...
@@ -91,22 +99,30 @@ void Foam::Time::readDict()
{
const
word
&
name
=
iter
().
keyword
();
simple
RegIOobject
*
objPtr
=
objects
.
lookupPtr
(
name
);
simple
ObjectRegistryEntry
*
objPtr
=
objects
.
lookupPtr
(
name
);
if
(
objPtr
)
{
Info
<<
" "
<<
iter
()
<<
endl
;
const
List
<
simpleRegIOobject
*>&
objects
=
*
objPtr
;
if
(
iter
().
isDict
())
{
OStringStream
os
(
IOstream
::
ASCII
);
os
<<
iter
().
dict
();
IStringStream
is
(
os
.
str
());
objPtr
->
readData
(
is
);
forAll
(
objects
,
i
)
{
OStringStream
os
(
IOstream
::
ASCII
);
os
<<
iter
().
dict
();
IStringStream
is
(
os
.
str
());
objects
[
i
]
->
readData
(
is
);
}
}
else
{
objPtr
->
readData
(
iter
().
stream
());
forAll
(
objects
,
i
)
{
objects
[
i
]
->
readData
(
iter
().
stream
());
}
}
}
}
...
...
@@ -133,11 +149,16 @@ void Foam::Time::readDict()
forAllConstIter
(
simpleObjectRegistry
,
objects
,
iter
)
{
iter
()
->
readData
(
dummyIs
);
const
List
<
simpleRegIOobject
*>&
objects
=
*
iter
;
forAll
(
objects
,
i
)
{
objects
[
i
]
->
readData
(
dummyIs
);
Info
<<
" "
;
iter
()
->
writeData
(
Info
);
Info
<<
endl
;
Info
<<
" "
;
objects
[
i
]
->
writeData
(
Info
);
Info
<<
endl
;
}
}
}
...
...
@@ -262,16 +283,21 @@ void Foam::Time::readDict()
simpleObjectRegistry
&
objects
=
debug
::
dimensionSetObjects
();
simple
RegIOobject
*
objPtr
=
objects
.
lookupPtr
(
"DimensionSets"
);
simple
ObjectRegistryEntry
*
objPtr
=
objects
.
lookupPtr
(
"DimensionSets"
);
if
(
objPtr
)
{
Info
<<
controlDict_
.
subDict
(
"DimensionSets"
)
<<
endl
;
OStringStream
os
(
IOstream
::
ASCII
);
os
<<
dict
;
IStringStream
is
(
os
.
str
());
objPtr
->
readData
(
is
);
const
List
<
simpleRegIOobject
*>&
objects
=
*
objPtr
;
forAll
(
objects
,
i
)
{
OStringStream
os
(
IOstream
::
ASCII
);
os
<<
dict
;
IStringStream
is
(
os
.
str
());
objects
[
i
]
->
readData
(
is
);
}
}
}
...
...
src/OpenFOAM/global/debug/debug.C
View file @
d73ae169
...
...
@@ -183,24 +183,42 @@ int Foam::debug::optimisationSwitch(const char* name, const int defaultValue)
void
Foam
::
debug
::
addDebugObject
(
const
char
*
name
,
simpleRegIOobject
*
obj
)
{
debugObjects
().
append
(
name
,
obj
);
simpleObjectRegistryEntry
*
ptr
=
debugObjects
().
lookupPtr
(
name
);
if
(
ptr
)
{
//std::cerr<< "debug::addDebugObject : Duplicate entry " << name
// << " in runtime selection table"
// << std::endl;
//error::safePrintStack(std::cerr);
ptr
->
append
(
obj
);
}
else
{
debugObjects
().
append
(
name
,
new
simpleObjectRegistryEntry
(
List
<
simpleRegIOobject
*>
(
1
,
obj
)
)
);
}
}
void
Foam
::
debug
::
addInfoObject
(
const
char
*
name
,
simpleRegIOobject
*
obj
)
{
infoObjects
().
append
(
name
,
obj
);
simpleObjectRegistryEntry
*
ptr
=
infoObjects
().
lookupPtr
(
name
);
if
(
ptr
)
{
ptr
->
append
(
obj
);
}
else
{
//std::cerr<< "debug::addInfoObject : Duplicate entry " << name
// << " in runtime selection table"
// << std::endl;
//error::safePrintStack(std::cerr);
infoObjects
().
append
(
name
,
new
simpleObjectRegistryEntry
(
List
<
simpleRegIOobject
*>
(
1
,
obj
)
)
);
}
}
...
...
@@ -211,12 +229,21 @@ void Foam::debug::addOptimisationObject
simpleRegIOobject
*
obj
)
{
optimisationObjects
().
append
(
name
,
obj
);
simpleObjectRegistryEntry
*
ptr
=
optimisationObjects
().
lookupPtr
(
name
);
if
(
ptr
)
{
//std::cerr<< "debug::addOptimisationObject : Duplicate entry " << name
// << " in runtime selection table"
// << std::endl;
//error::safePrintStack(std::cerr);
ptr
->
append
(
obj
);
}
else
{
optimisationObjects
().
append
(
name
,
new
simpleObjectRegistryEntry
(
List
<
simpleRegIOobject
*>
(
1
,
obj
)
)
);
}
}
...
...
@@ -227,12 +254,21 @@ void Foam::debug::addDimensionSetObject
simpleRegIOobject
*
obj
)
{
dimensionSetObjects
().
append
(
name
,
obj
);
simpleObjectRegistryEntry
*
ptr
=
dimensionSetObjects
().
lookupPtr
(
name
);
if
(
ptr
)
{
//std::cerr<< "debug::addDimensionSetObject : Duplicate entry " << name
// << " in runtime selection table"
// << std::endl;
//error::safePrintStack(std::cerr);
ptr
->
append
(
obj
);
}
else
{
dimensionSetObjects
().
append
(
name
,
new
simpleObjectRegistryEntry
(
List
<
simpleRegIOobject
*>
(
1
,
obj
)
)
);
}
}
...
...
@@ -243,13 +279,24 @@ void Foam::debug::addDimensionedConstantObject
simpleRegIOobject
*
obj
)
{
dimensionedConstantObjects
().
append
(
name
,
obj
);
simpleObjectRegistryEntry
*
ptr
=
dimensionedConstantObjects
().
lookupPtr
(
name
);
if
(
ptr
)
{
ptr
->
append
(
obj
);
}
else
{
//std::cerr<< "debug::addDimensionedConstantObject : Duplicate entry "
// << name
// << " in runtime selection table"
// << std::endl;
//error::safePrintStack(std::cerr);
dimensionedConstantObjects
().
append
(
name
,
new
simpleObjectRegistryEntry
(
List
<
simpleRegIOobject
*>
(
1
,
obj
)
)
);
}
}
...
...
src/OpenFOAM/global/debug/simpleObjectRegistry.H
View file @
d73ae169
...
...
@@ -34,7 +34,8 @@ SourceFiles
#ifndef simpleObjectRegistry_H
#define simpleObjectRegistry_H
#include
"UPtrDictionary.H"
//#include "UPtrDictionary.H"
#include
"Dictionary.H"
#include
"simpleRegIOobject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -43,12 +44,30 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class simpleObjectRegistry Declaration
Class simpleObjectRegistryEntry Declaration
\*---------------------------------------------------------------------------*/
class
simpleObjectRegistryEntry
:
public
Dictionary
<
simpleObjectRegistryEntry
>::
link
,
public
List
<
simpleRegIOobject
*>
{
public:
simpleObjectRegistryEntry
(
const
List
<
simpleRegIOobject
*>&
data
)
:
List
<
simpleRegIOobject
*>
(
data
)
{}
};
/*---------------------------------------------------------------------------*\
Class simpleObjectRegistry Declaration
\*---------------------------------------------------------------------------*/
class
simpleObjectRegistry
:
public
UPtr
Dictionary
<
simple
RegIOobject
>
public
Dictionary
<
simple
ObjectRegistryEntry
>
{
public:
...
...
@@ -57,7 +76,7 @@ public:
//- Construct given initial table size
simpleObjectRegistry
(
const
label
nIoObjects
=
128
)
:
UPtr
Dictionary
<
simple
RegIOobject
>
(
nIoObjects
)
Dictionary
<
simple
ObjectRegistryEntry
>
(
nIoObjects
)
{}
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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