Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
d80ce7fc
Commit
d80ce7fc
authored
15 years ago
by
Mark Olesen
Browse files
Options
Downloads
Patches
Plain Diff
objectRegistry - gets sortedNames() methods
- reduce duplicate code by using some HashTable methods directly
parent
a0b3d145
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/OpenFOAM/db/objectRegistry/objectRegistry.C
+23
-16
23 additions, 16 deletions
src/OpenFOAM/db/objectRegistry/objectRegistry.C
src/OpenFOAM/db/objectRegistry/objectRegistry.H
+9
-3
9 additions, 3 deletions
src/OpenFOAM/db/objectRegistry/objectRegistry.H
with
32 additions
and
19 deletions
src/OpenFOAM/db/objectRegistry/objectRegistry.C
+
23
−
16
View file @
d80ce7fc
...
@@ -93,7 +93,7 @@ Foam::objectRegistry::~objectRegistry()
...
@@ -93,7 +93,7 @@ Foam::objectRegistry::~objectRegistry()
}
}
}
}
for
(
label
i
=
0
;
i
<
nMyObjects
;
i
++
)
for
(
label
i
=
0
;
i
<
nMyObjects
;
i
++
)
{
{
checkOut
(
*
myObjects
[
i
]);
checkOut
(
*
myObjects
[
i
]);
}
}
...
@@ -104,15 +104,13 @@ Foam::objectRegistry::~objectRegistry()
...
@@ -104,15 +104,13 @@ Foam::objectRegistry::~objectRegistry()
Foam
::
wordList
Foam
::
objectRegistry
::
names
()
const
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
...
@@ -125,7 +123,7 @@ Foam::wordList Foam::objectRegistry::names(const word& ClassName) const
{
{
if
(
iter
()
->
type
()
==
ClassName
)
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
...
@@ -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
Foam
::
objectRegistry
&
Foam
::
objectRegistry
::
subRegistry
(
(
const
word
&
name
const
word
&
name
...
@@ -151,8 +158,8 @@ Foam::label Foam::objectRegistry::getEvent() const
...
@@ -151,8 +158,8 @@ Foam::label Foam::objectRegistry::getEvent() const
if
(
event_
==
labelMax
)
if
(
event_
==
labelMax
)
{
{
WarningIn
(
"objectRegistry::getEvent() const"
)
WarningIn
(
"objectRegistry::getEvent() const"
)
<<
"Event counter has overflowed.
Resetting counter on all
"
<<
"Event counter has overflowed. "
<<
" dependent objects."
<<
end
l
<<
"
Resetting counter on all
dependent objects."
<<
n
l
<<
"This might cause extra evaluations."
<<
endl
;
<<
"This might cause extra evaluations."
<<
endl
;
// Reset event counter
// Reset event counter
...
@@ -202,7 +209,7 @@ bool Foam::objectRegistry::checkOut(regIOobject& io) const
...
@@ -202,7 +209,7 @@ bool Foam::objectRegistry::checkOut(regIOobject& io) const
if
(
objectRegistry
::
debug
)
if
(
objectRegistry
::
debug
)
{
{
Pout
<<
"objectRegistry::checkOut(regIOobject&) : "
Pout
<<
"objectRegistry::checkOut(regIOobject&) : "
<<
name
()
<<
" : checking out "
<<
i
o
.
name
()
<<
name
()
<<
" : checking out "
<<
i
ter
.
key
()
<<
endl
;
<<
endl
;
}
}
...
@@ -211,7 +218,8 @@ bool Foam::objectRegistry::checkOut(regIOobject& io) const
...
@@ -211,7 +218,8 @@ bool Foam::objectRegistry::checkOut(regIOobject& io) const
if
(
objectRegistry
::
debug
)
if
(
objectRegistry
::
debug
)
{
{
WarningIn
(
"objectRegistry::checkOut(regIOobject&)"
)
WarningIn
(
"objectRegistry::checkOut(regIOobject&)"
)
<<
name
()
<<
" : attempt to checkOut copy of "
<<
io
.
name
()
<<
name
()
<<
" : attempt to checkOut copy of "
<<
iter
.
key
()
<<
endl
;
<<
endl
;
}
}
...
@@ -286,8 +294,7 @@ void Foam::objectRegistry::readModifiedObjects()
...
@@ -286,8 +294,7 @@ void Foam::objectRegistry::readModifiedObjects()
{
{
Pout
<<
"objectRegistry::readModifiedObjects() : "
Pout
<<
"objectRegistry::readModifiedObjects() : "
<<
name
()
<<
" : Considering reading object "
<<
name
()
<<
" : Considering reading object "
<<
iter
()
->
name
()
<<
iter
.
key
()
<<
endl
;
<<
endl
;
}
}
iter
()
->
readIfModified
();
iter
()
->
readIfModified
();
...
@@ -317,7 +324,7 @@ bool Foam::objectRegistry::writeObject
...
@@ -317,7 +324,7 @@ bool Foam::objectRegistry::writeObject
{
{
Pout
<<
"objectRegistry::write() : "
Pout
<<
"objectRegistry::write() : "
<<
name
()
<<
" : Considering writing object "
<<
name
()
<<
" : Considering writing object "
<<
iter
()
->
name
()
<<
iter
.
key
()
<<
" with writeOpt "
<<
iter
()
->
writeOpt
()
<<
" with writeOpt "
<<
iter
()
->
writeOpt
()
<<
" to file "
<<
iter
()
->
objectPath
()
<<
" to file "
<<
iter
()
->
objectPath
()
<<
endl
;
<<
endl
;
...
...
This diff is collapsed.
Click to expand it.
src/OpenFOAM/db/objectRegistry/objectRegistry.H
+
9
−
3
View file @
d80ce7fc
...
@@ -132,9 +132,15 @@ public:
...
@@ -132,9 +132,15 @@ public:
//- Return the list of names of the IOobjects
//- Return the list of names of the IOobjects
wordList
names
()
const
;
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
;
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
//- Return the list of names of the IOobjects of given type
template
<
class
Type
>
template
<
class
Type
>
wordList
names
()
const
;
wordList
names
()
const
;
...
@@ -142,11 +148,11 @@ public:
...
@@ -142,11 +148,11 @@ public:
//- Lookup and return a const sub-objectRegistry
//- Lookup and return a const sub-objectRegistry
const
objectRegistry
&
subRegistry
(
const
word
&
name
)
const
;
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
>
template
<
class
Type
>
HashTable
<
const
Type
*>
lookupClass
()
const
;
HashTable
<
const
Type
*>
lookupClass
()
const
;
//- Is the named Type
//- Is the named Type
found?
template
<
class
Type
>
template
<
class
Type
>
bool
foundObject
(
const
word
&
name
)
const
;
bool
foundObject
(
const
word
&
name
)
const
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment