Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nektar
Nektar
Commits
3008cf01
Commit
3008cf01
authored
Jun 21, 2017
by
Douglas Serson
Browse files
Allow using nprocs without procid in FieldConvert
parent
d8ba38be
Changes
6
Hide whitespace changes
Inline
Side-by-side
library/FieldUtils/Field.hpp
View file @
3008cf01
...
...
@@ -717,6 +717,17 @@ struct Field
return
tmp
;
}
FIELD_UTILS_EXPORT
void
ClearField
()
{
m_session
=
LibUtilities
::
SessionReaderSharedPtr
();
m_graph
=
SpatialDomains
::
MeshGraphSharedPtr
();
m_fieldPts
=
LibUtilities
::
NullPtsField
;
m_exp
.
clear
();
m_fielddef
=
std
::
vector
<
LibUtilities
::
FieldDefinitionsSharedPtr
>
();
m_data
=
std
::
vector
<
std
::
vector
<
NekDouble
>
>
();
m_variables
.
clear
();
}
private:
/// Map to store FieldIO instances. Key is the reader type, value is the
/// FieldIO object.
...
...
library/FieldUtils/OutputModules/OutputFileBase.cpp
View file @
3008cf01
...
...
@@ -249,7 +249,7 @@ bool OutputFileBase::WriteFile(std::string &filename, po::variables_map &vm)
// Get path to file. If procid was defined, get the full name
// to avoid checking files from other partitions
fs
::
path
outFile
;
if
(
vm
.
count
(
"proc
id
"
))
if
(
vm
.
count
(
"
n
proc
s
"
))
{
outFile
=
GetFullOutName
(
filename
,
vm
);
}
...
...
library/FieldUtils/OutputModules/OutputInfo.cpp
View file @
3008cf01
...
...
@@ -55,6 +55,7 @@ ModuleKey OutputInfo::m_className =
OutputInfo
::
OutputInfo
(
FieldSharedPtr
f
)
:
OutputModule
(
f
)
{
m_config
[
"nprocs"
]
=
ConfigOption
(
false
,
"1"
,
"number of partitions"
);
}
OutputInfo
::~
OutputInfo
()
...
...
@@ -68,10 +69,9 @@ void OutputInfo::Process(po::variables_map &vm)
int
i
;
// partition mesh
ASSERTL0
(
vm
.
count
(
"nprocs"
)
>
0
,
"--nprocs nust be specified with info output"
);
int
nprocs
=
vm
[
"nprocs"
].
as
<
int
>
();
ASSERTL0
(
m_config
[
"nprocs"
].
as
<
string
>
().
compare
(
"NotSet"
)
!=
0
,
"Need to specify nprocs for info output"
);
int
nprocs
=
m_config
[
"nprocs"
].
as
<
int
>
();
LibUtilities
::
CommSharedPtr
vComm
=
boost
::
shared_ptr
<
FieldConvertComm
>
(
new
FieldConvertComm
(
0
,
NULL
,
nprocs
,
0
));
...
...
library/SolverUtils/Filters/FilterFieldConvert.cpp
View file @
3008cf01
...
...
@@ -179,11 +179,6 @@ void FilterFieldConvert::v_Initialise(
m_fieldMetaData
[
"InitialTime"
]
=
boost
::
lexical_cast
<
std
::
string
>
(
time
);
// Fill some parameters of m_f
m_f
->
m_session
=
m_session
;
m_f
->
m_graph
=
pFields
[
0
]
->
GetGraph
();
m_f
->
m_comm
=
m_f
->
m_session
->
GetComm
();
// Load restart file if necessary
if
(
m_restartFile
!=
""
)
{
...
...
@@ -363,7 +358,7 @@ void FilterFieldConvert::OutputField(
}
// Empty m_f to save memory
ClearField
s
();
m_f
->
ClearField
();
if
(
dump
!=
-
1
)
// not final dump so rescale
{
...
...
@@ -483,6 +478,10 @@ void FilterFieldConvert::CreateModules( vector<string> &modcmds)
void
FilterFieldConvert
::
CreateFields
(
const
Array
<
OneD
,
const
MultiRegions
::
ExpListSharedPtr
>
&
pFields
)
{
// Fill some parameters of m_f
m_f
->
m_session
=
m_session
;
m_f
->
m_graph
=
pFields
[
0
]
->
GetGraph
();
m_f
->
m_comm
=
m_f
->
m_session
->
GetComm
();
m_f
->
m_fieldMetaDataMap
=
m_fieldMetaData
;
m_f
->
m_fieldPts
=
LibUtilities
::
NullPtsField
;
// Create m_f->m_exp
...
...
@@ -521,14 +520,6 @@ void FilterFieldConvert::CreateFields(
m_f
->
m_variables
=
m_variables
;
}
void
FilterFieldConvert
::
ClearFields
()
{
m_f
->
m_fieldPts
=
LibUtilities
::
NullPtsField
;
m_f
->
m_exp
.
clear
();
m_f
->
m_fielddef
=
std
::
vector
<
LibUtilities
::
FieldDefinitionsSharedPtr
>
();
m_f
->
m_data
=
std
::
vector
<
std
::
vector
<
NekDouble
>
>
();
}
// This function checks validity conditions for the list of modules provided
void
FilterFieldConvert
::
CheckModules
(
vector
<
ModuleSharedPtr
>
&
modules
)
{
...
...
library/SolverUtils/Filters/FilterFieldConvert.h
View file @
3008cf01
...
...
@@ -110,8 +110,6 @@ protected:
void
CreateFields
(
const
Array
<
OneD
,
const
MultiRegions
::
ExpListSharedPtr
>
&
pFields
);
void
ClearFields
();
void
CheckModules
(
vector
<
ModuleSharedPtr
>
&
modules
);
unsigned
int
m_numSamples
;
...
...
utilities/FieldConvert/FieldConvert.cpp
View file @
3008cf01
...
...
@@ -209,16 +209,22 @@ int main(int argc, char* argv[])
* name of the module to load.
*/
FieldSharedPtr
f
=
boost
::
shared_ptr
<
Field
>
(
new
Field
());
int
nParts
=
1
;
if
(
LibUtilities
::
GetCommFactory
().
ModuleExists
(
"ParallelMPI"
))
{
if
(
vm
.
count
(
"proc
id
"
))
if
(
vm
.
count
(
"
n
proc
s
"
))
{
int
nprocs
,
rank
;
ASSERTL0
(
vm
.
count
(
"nprocs"
),
"Must specify --nprocs when using --procid option"
);
nprocs
=
vm
[
"nprocs"
].
as
<
int
>
();
rank
=
vm
[
"procid"
].
as
<
int
>
();
if
(
vm
.
count
(
"procid"
))
{
rank
=
vm
[
"procid"
].
as
<
int
>
();
}
else
{
nParts
=
nprocs
;
rank
=
0
;
}
f
->
m_comm
=
boost
::
shared_ptr
<
FieldConvertComm
>
(
new
FieldConvertComm
(
argc
,
argv
,
nprocs
,
rank
));
...
...
@@ -415,15 +421,30 @@ int main(int argc, char* argv[])
PrintExecutionSequence
(
modules
);
}
//
Run field process.
for
(
int
n
=
0
;
n
<
SIZE_ModulePriority
;
++
n
)
//
Loop on partitions when using nprocs without procid
for
(
int
p
=
0
;
p
<
nParts
;
++
p
)
{
ModulePriority
priority
=
static_cast
<
ModulePriority
>
(
n
);
for
(
int
i
=
0
;
i
<
modules
.
size
();
++
i
)
if
(
verbose
&&
nParts
>
1
)
{
if
(
modules
[
i
]
->
GetModulePriority
()
==
priority
)
cout
<<
endl
<<
"Processing partition: "
<<
p
<<
endl
;
}
if
(
p
>
0
)
{
int
rank
=
p
;
f
->
ClearField
();
f
->
m_comm
=
boost
::
shared_ptr
<
FieldConvertComm
>
(
new
FieldConvertComm
(
argc
,
argv
,
nParts
,
rank
));
}
// Run field process.
for
(
int
n
=
0
;
n
<
SIZE_ModulePriority
;
++
n
)
{
ModulePriority
priority
=
static_cast
<
ModulePriority
>
(
n
);
for
(
int
i
=
0
;
i
<
modules
.
size
();
++
i
)
{
RunModule
(
modules
[
i
],
vm
,
verbose
);
if
(
modules
[
i
]
->
GetModulePriority
()
==
priority
)
{
RunModule
(
modules
[
i
],
vm
,
verbose
);
}
}
}
}
...
...
Write
Preview
Supports
Markdown
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