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
d80ce7fc
Commit
d80ce7fc
authored
Dec 01, 2009
by
Mark Olesen
Browse files
objectRegistry - gets sortedNames() methods
- reduce duplicate code by using some HashTable methods directly
parent
a0b3d145
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/db/objectRegistry/objectRegistry.C
View file @
d80ce7fc
...
...
@@ -93,7 +93,7 @@ Foam::objectRegistry::~objectRegistry()
}
}
for
(
label
i
=
0
;
i
<
nMyObjects
;
i
++
)
for
(
label
i
=
0
;
i
<
nMyObjects
;
i
++
)
{
checkOut
(
*
myObjects
[
i
]);
}
...
...
@@ -104,15 +104,13 @@ Foam::objectRegistry::~objectRegistry()
Foam
::
wordList
Foam
::
objectRegistry
::
names
()
const
{
wordList
objectNames
(
size
());
return
HashTable
<
regIOobject
*>::
toc
();
}
label
count
=
0
;
for
(
const_iterator
iter
=
cbegin
();
iter
!=
cend
();
++
iter
)
{
objectNames
[
count
++
]
=
iter
()
->
name
();
}
return
objectNames
;
Foam
::
wordList
Foam
::
objectRegistry
::
sortedNames
()
const
{
return
HashTable
<
regIOobject
*>::
sortedToc
();
}
...
...
@@ -125,7 +123,7 @@ Foam::wordList Foam::objectRegistry::names(const word& ClassName) const
{
if
(
iter
()
->
type
()
==
ClassName
)
{
objectNames
[
count
++
]
=
iter
()
->
name
();
objectNames
[
count
++
]
=
iter
.
key
();
}
}
...
...
@@ -135,6 +133,15 @@ Foam::wordList Foam::objectRegistry::names(const word& ClassName) const
}
Foam
::
wordList
Foam
::
objectRegistry
::
sortedNames
(
const
word
&
ClassName
)
const
{
wordList
sortedLst
=
names
(
ClassName
);
sort
(
sortedLst
);
return
sortedLst
;
}
const
Foam
::
objectRegistry
&
Foam
::
objectRegistry
::
subRegistry
(
const
word
&
name
...
...
@@ -151,8 +158,8 @@ Foam::label Foam::objectRegistry::getEvent() const
if
(
event_
==
labelMax
)
{
WarningIn
(
"objectRegistry::getEvent() const"
)
<<
"Event counter has overflowed.
Resetting counter on all
"
<<
" dependent objects."
<<
end
l
<<
"Event counter has overflowed. "
<<
"
Resetting counter on all
dependent objects."
<<
n
l
<<
"This might cause extra evaluations."
<<
endl
;
// Reset event counter
...
...
@@ -202,7 +209,7 @@ bool Foam::objectRegistry::checkOut(regIOobject& io) const
if
(
objectRegistry
::
debug
)
{
Pout
<<
"objectRegistry::checkOut(regIOobject&) : "
<<
name
()
<<
" : checking out "
<<
i
o
.
name
()
<<
name
()
<<
" : checking out "
<<
i
ter
.
key
()
<<
endl
;
}
...
...
@@ -211,7 +218,8 @@ bool Foam::objectRegistry::checkOut(regIOobject& io) const
if
(
objectRegistry
::
debug
)
{
WarningIn
(
"objectRegistry::checkOut(regIOobject&)"
)
<<
name
()
<<
" : attempt to checkOut copy of "
<<
io
.
name
()
<<
name
()
<<
" : attempt to checkOut copy of "
<<
iter
.
key
()
<<
endl
;
}
...
...
@@ -286,8 +294,7 @@ void Foam::objectRegistry::readModifiedObjects()
{
Pout
<<
"objectRegistry::readModifiedObjects() : "
<<
name
()
<<
" : Considering reading object "
<<
iter
()
->
name
()
<<
endl
;
<<
iter
.
key
()
<<
endl
;
}
iter
()
->
readIfModified
();
...
...
@@ -317,7 +324,7 @@ bool Foam::objectRegistry::writeObject
{
Pout
<<
"objectRegistry::write() : "
<<
name
()
<<
" : Considering writing object "
<<
iter
()
->
name
()
<<
iter
.
key
()
<<
" with writeOpt "
<<
iter
()
->
writeOpt
()
<<
" to file "
<<
iter
()
->
objectPath
()
<<
endl
;
...
...
src/OpenFOAM/db/objectRegistry/objectRegistry.H
View file @
d80ce7fc
...
...
@@ -132,9 +132,15 @@ public:
//- Return the list of names of the IOobjects
wordList
names
()
const
;
//- Return the list of names of the IOobjects of given class name
//- Return the sorted list of names of the IOobjects
wordList
sortedNames
()
const
;
//- Return the list of names of IOobjects of given class name
wordList
names
(
const
word
&
className
)
const
;
//- Return the sorted list of names of IOobjects of given class name
wordList
sortedNames
(
const
word
&
className
)
const
;
//- Return the list of names of the IOobjects of given type
template
<
class
Type
>
wordList
names
()
const
;
...
...
@@ -142,11 +148,11 @@ public:
//- Lookup and return a const sub-objectRegistry
const
objectRegistry
&
subRegistry
(
const
word
&
name
)
const
;
//- Lookup and return all
the
object of the given Type
//- Lookup and return all object
s
of the given Type
template
<
class
Type
>
HashTable
<
const
Type
*>
lookupClass
()
const
;
//- Is the named Type
//- Is the named Type
found?
template
<
class
Type
>
bool
foundObject
(
const
word
&
name
)
const
;
...
...
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