Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ADIOS2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
Podhorszki, Norbert
ADIOS2
Commits
c68ed079
Commit
c68ed079
authored
7 years ago
by
Podhorszki, Norbert
Browse files
Options
Downloads
Patches
Plain Diff
Move some dimension checks into separate function so Write() can check them as well.
parent
2a56236d
No related branches found
No related tags found
1 merge request
!224
Fix the variable definition initialization rules and add test for Def…
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
source/adios2/core/Engine.inl
+1
-1
1 addition, 1 deletion
source/adios2/core/Engine.inl
source/adios2/core/VariableBase.cpp
+25
-13
25 additions, 13 deletions
source/adios2/core/VariableBase.cpp
source/adios2/core/VariableBase.h
+6
-1
6 additions, 1 deletion
source/adios2/core/VariableBase.h
with
32 additions
and
15 deletions
source/adios2/core/Engine.inl
+
1
−
1
View file @
c68ed079
...
@@ -29,7 +29,7 @@ void Engine::Write(Variable<T> &variable, const T *values)
...
@@ -29,7 +29,7 @@ void Engine::Write(Variable<T> &variable, const T *values)
{
{
if (m_DebugMode)
if (m_DebugMode)
{
{
variable.CheckDims
("in call to Write
");
variable.CheckDims
BeforeWrite("Write(" + variable.m_Name + ")
");
}
}
DoWrite(variable, values);
DoWrite(variable, values);
...
...
This diff is collapsed.
Click to expand it.
source/adios2/core/VariableBase.cpp
+
25
−
13
View file @
c68ed079
...
@@ -168,14 +168,6 @@ void VariableBase::InitShapeType()
...
@@ -168,14 +168,6 @@ void VariableBase::InitShapeType()
}
}
m_ShapeID
=
ShapeID
::
JoinedArray
;
m_ShapeID
=
ShapeID
::
JoinedArray
;
}
}
else
if
(
std
::
count
(
m_Shape
.
begin
(),
m_Shape
.
end
(),
JoinedDim
)
>
1
)
{
throw
std
::
invalid_argument
(
"ERROR: variable can't have more than one "
"JoinedDim in shape argument, in call to "
"DefineVariable "
+
m_Name
+
"
\n
"
);
}
else
if
(
m_Start
.
empty
()
&&
m_Count
.
empty
())
else
if
(
m_Start
.
empty
()
&&
m_Count
.
empty
())
{
{
if
(
m_Shape
.
size
()
==
1
&&
m_Shape
.
front
()
==
LocalValueDim
)
if
(
m_Shape
.
size
()
==
1
&&
m_Shape
.
front
()
==
LocalValueDim
)
...
@@ -265,6 +257,12 @@ void VariableBase::InitShapeType()
...
@@ -265,6 +257,12 @@ void VariableBase::InitShapeType()
}
}
/* Extra checks for invalid settings */
/* Extra checks for invalid settings */
if
(
m_DebugMode
)
CheckDimsCommon
(
"DefineVariable("
+
m_Name
+
")"
);
}
void
VariableBase
::
CheckDimsCommon
(
const
std
::
string
hint
)
const
{
if
(
m_ShapeID
!=
ShapeID
::
LocalValue
)
if
(
m_ShapeID
!=
ShapeID
::
LocalValue
)
{
{
if
((
!
m_Shape
.
empty
()
&&
if
((
!
m_Shape
.
empty
()
&&
...
@@ -276,14 +274,26 @@ void VariableBase::InitShapeType()
...
@@ -276,14 +274,26 @@ void VariableBase::InitShapeType()
{
{
throw
std
::
invalid_argument
(
"ERROR: LocalValueDim is only "
throw
std
::
invalid_argument
(
"ERROR: LocalValueDim is only "
"allowed in a {LocalValueDim} "
"allowed in a {LocalValueDim} "
"shape in call to "
"shape in call to "
+
"DefineVariable "
+
hint
+
"
\n
"
);
m_Name
+
"
\n
"
);
}
}
}
}
if
((
!
m_Shape
.
empty
()
&&
std
::
count
(
m_Shape
.
begin
(),
m_Shape
.
end
(),
JoinedDim
)
>
1
)
||
(
!
m_Start
.
empty
()
&&
std
::
count
(
m_Start
.
begin
(),
m_Start
.
end
(),
JoinedDim
)
>
0
)
||
(
!
m_Count
.
empty
()
&&
std
::
count
(
m_Count
.
begin
(),
m_Count
.
end
(),
JoinedDim
)
>
0
))
{
throw
std
::
invalid_argument
(
"ERROR: JoinedDim is only allowed once in "
"Shape and cannot appear in Start/Count in "
"call to "
+
hint
+
"
\n
"
);
}
}
}
void
VariableBase
::
CheckDims
(
const
std
::
string
hint
)
const
void
VariableBase
::
CheckDims
BeforeWrite
(
const
std
::
string
hint
)
const
{
{
if
(
m_ShapeID
==
ShapeID
::
GlobalArray
)
if
(
m_ShapeID
==
ShapeID
::
GlobalArray
)
{
{
...
@@ -292,10 +302,12 @@ void VariableBase::CheckDims(const std::string hint) const
...
@@ -292,10 +302,12 @@ void VariableBase::CheckDims(const std::string hint) const
throw
std
::
invalid_argument
(
throw
std
::
invalid_argument
(
"ERROR: GlobalArray variable "
+
m_Name
+
"ERROR: GlobalArray variable "
+
m_Name
+
" start and count dimensions must be defined by either "
" start and count dimensions must be defined by either "
"DefineVariable or a Selection "
+
"DefineVariable or a Selection
in call to
"
+
hint
+
"
\n
"
);
hint
+
"
\n
"
);
}
}
}
}
CheckDimsCommon
(
hint
);
// TODO need to think more exceptions here
// TODO need to think more exceptions here
}
}
...
...
This diff is collapsed.
Click to expand it.
source/adios2/core/VariableBase.h
+
6
−
1
View file @
c68ed079
...
@@ -137,9 +137,14 @@ public:
...
@@ -137,9 +137,14 @@ public:
/** Registered transforms */
/** Registered transforms */
std
::
vector
<
TransformInfo
>
m_TransformsInfo
;
std
::
vector
<
TransformInfo
>
m_TransformsInfo
;
/** Self-check dims according to type, called right after DefineVariable and
* SetSelection.
* @param hint extra debugging info for the exception */
void
CheckDimsCommon
(
const
std
::
string
hint
)
const
;
/** Self-check dims according to type, called from Engine before Write
/** Self-check dims according to type, called from Engine before Write
* @param hint extra debugging info for the exception */
* @param hint extra debugging info for the exception */
void
CheckDims
(
const
std
::
string
hint
)
const
;
void
CheckDims
BeforeWrite
(
const
std
::
string
hint
)
const
;
private
:
private
:
const
bool
m_DebugMode
=
false
;
const
bool
m_DebugMode
=
false
;
...
...
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