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
1a4190e7
Commit
1a4190e7
authored
Dec 03, 2010
by
mattijs
Browse files
ENH: IOdictionary : tree distribution of master dictionary
parent
a17c3f96
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C
View file @
1a4190e7
...
...
@@ -55,46 +55,59 @@ void Foam::IOdictionary::readFile(const bool masterOnly)
close
();
}
if
(
masterOnly
)
if
(
masterOnly
&&
Pstream
::
parRun
()
)
{
// Scatter master data
if
(
Pstream
::
master
())
// Scatter master data using communication scheme
const
List
<
Pstream
::
commsStruct
>&
comms
=
(
(
Pstream
::
nProcs
()
<
Pstream
::
nProcsSimpleSum
)
?
Pstream
::
linearCommunication
()
:
Pstream
::
treeCommunication
()
);
// Get my communication order
const
Pstream
::
commsStruct
&
myComm
=
comms
[
Pstream
::
myProcNo
()];
// Reveive from up
if
(
myComm
.
above
()
!=
-
1
)
{
for
(
int
slave
=
Pstream
::
firstSlave
();
slave
<=
Pstream
::
lastSlave
();
slave
++
)
if
(
debug
)
{
// Note: use ASCII for now - binary IO of dictionaries is
// not currently supported
OPstream
toSlave
(
Pstream
::
scheduled
,
slave
,
0
,
UPstream
::
msgType
(),
IOstream
::
ASCII
);
IOdictionary
::
writeData
(
toSlave
);
Pout
<<
"IOdictionary : Reading "
<<
objectPath
()
<<
" from processor "
<<
myComm
.
above
()
<<
endl
;
}
// Note: use ASCII for now - binary IO of dictionaries is
// not currently supported
IPstream
fromAbove
(
Pstream
::
scheduled
,
myComm
.
above
(),
0
,
IOstream
::
ASCII
);
IOdictionary
::
readData
(
fromAbove
);
}
else
// Send to my downstairs neighbours
forAll
(
myComm
.
below
(),
belowI
)
{
if
(
debug
)
{
Pout
<<
"IOdictionary :
Rea
ding "
<<
objectPath
()
<<
"
from master
processor "
<<
Pstream
::
masterNo
()
<<
endl
;
Pout
<<
"IOdictionary :
Sen
ding "
<<
objectPath
()
<<
"
to
processor "
<<
myComm
.
below
()[
belowI
]
<<
endl
;
}
I
Pstream
fromMaster
O
Pstream
toBelow
(
Pstream
::
scheduled
,
Pstream
::
masterNo
()
,
myComm
.
below
()[
belowI
]
,
0
,
Pstream
::
msgType
(),
IOstream
::
ASCII
);
IOdictionary
::
readData
(
fromMaster
);
IOdictionary
::
writeData
(
toBelow
);
}
}
}
...
...
src/OpenFOAM/db/regIOobject/regIOobjectRead.C
View file @
1a4190e7
...
...
@@ -177,55 +177,69 @@ bool Foam::regIOobject::read()
regIOobject
::
fileModificationChecking
==
timeStampMaster
||
regIOobject
::
fileModificationChecking
==
inotifyMaster
;
bool
ok
;
bool
ok
=
true
;
if
(
Pstream
::
master
()
||
!
masterOnly
)
{
if
(
IFstream
::
debug
)
{
Pout
<<
"regIOobject::read() : "
<<
"reading object "
<<
name
()
<<
" from file "
<<
endl
;
}
ok
=
readData
(
readStream
(
type
()));
close
();
}
if
(
masterOnly
)
if
(
masterOnly
&&
Pstream
::
parRun
()
)
{
// Scatter master data
if
(
Pstream
::
master
())
{
for
(
int
slave
=
Pstream
::
firstSlave
();
slave
<=
Pstream
::
lastSlave
();
slave
++
)
{
// Note: use ASCII for now - binary IO of dictionaries is
// not currently supported
OPstream
toSlave
(
Pstream
::
scheduled
,
slave
,
0
,
UPstream
::
msgType
(),
IOstream
::
ASCII
);
writeData
(
toSlave
);
}
}
else
// Scatter master data using communication scheme
const
List
<
Pstream
::
commsStruct
>&
comms
=
(
(
Pstream
::
nProcs
()
<
Pstream
::
nProcsSimpleSum
)
?
Pstream
::
linearCommunication
()
:
Pstream
::
treeCommunication
()
);
// Get my communication order
const
Pstream
::
commsStruct
&
myComm
=
comms
[
Pstream
::
myProcNo
()];
// Reveive from up
if
(
myComm
.
above
()
!=
-
1
)
{
if
(
IFstream
::
debug
)
{
Pout
<<
"regIOobject::read() : "
<<
"reading object "
<<
name
()
<<
" from
master
processor "
<<
Pstream
::
masterNo
()
<<
" from processor "
<<
myComm
.
above
()
<<
endl
;
}
IPstream
fromMaster
// Note: use ASCII for now - binary IO of dictionaries is
// not currently supported
IPstream
fromAbove
(
Pstream
::
scheduled
,
myComm
.
above
(),
0
,
IOstream
::
ASCII
);
ok
=
readData
(
fromAbove
);
}
// Send to my downstairs neighbours
forAll
(
myComm
.
below
(),
belowI
)
{
OPstream
toBelow
(
Pstream
::
scheduled
,
Pstream
::
masterNo
()
,
myComm
.
below
()[
belowI
]
,
0
,
Pstream
::
msgType
(),
IOstream
::
ASCII
);
ok
=
readData
(
fromMaster
);
writeData
(
toBelow
);
}
}
return
ok
;
...
...
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