Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
sensei
sensei
Commits
6739e88d
Commit
6739e88d
authored
Mar 02, 2016
by
Andrew Bauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converting const char* to std::string for consistency.
parent
7c29a0d4
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
25 deletions
+33
-25
miniapps/oscillators/dataadaptor.cpp
miniapps/oscillators/dataadaptor.cpp
+7
-4
miniapps/oscillators/dataadaptor.h
miniapps/oscillators/dataadaptor.h
+3
-3
miniapps/parallel3d/DataAdaptor.cxx
miniapps/parallel3d/DataAdaptor.cxx
+7
-7
miniapps/parallel3d/DataAdaptor.h
miniapps/parallel3d/DataAdaptor.h
+2
-2
sensei/Autocorrelation.cxx
sensei/Autocorrelation.cxx
+4
-4
sensei/Autocorrelation.h
sensei/Autocorrelation.h
+4
-2
sensei/ConfigurableAnalysis.cxx
sensei/ConfigurableAnalysis.cxx
+2
-1
sensei/DataAdaptor.h
sensei/DataAdaptor.h
+4
-2
No files found.
miniapps/oscillators/dataadaptor.cpp
View file @
6739e88d
...
...
@@ -127,12 +127,15 @@ vtkDataObject* DataAdaptor::GetBlockMesh(int gid)
}
//-----------------------------------------------------------------------------
bool
DataAdaptor
::
AddArray
(
vtkDataObject
*
mesh
,
int
association
,
const
char
*
arrayname
)
bool
DataAdaptor
::
AddArray
(
vtkDataObject
*
mesh
,
int
association
,
const
std
::
string
&
arrayname
)
{
#ifndef NDEBUG
if
(
association
!=
vtkDataObject
::
FIELD_ASSOCIATION_CELLS
||
arrayname
==
NULL
||
strcmp
(
arrayname
,
"data"
)
!=
0
)
arrayname
!=
"data"
)
{
return
false
;
}
#endif
bool
retVal
=
false
;
DInternals
&
internals
=
(
*
this
->
Internals
);
...
...
@@ -146,10 +149,10 @@ bool DataAdaptor::AddArray(vtkDataObject* mesh, int association, const char* arr
vtkSmartPointer
<
vtkImageData
>&
blockMesh
=
internals
.
BlockMesh
[
cc
];
if
(
vtkCellData
*
cd
=
(
blockMesh
?
blockMesh
->
GetCellData
()
:
NULL
))
{
if
(
cd
->
GetArray
(
arrayname
)
==
NULL
)
if
(
cd
->
GetArray
(
arrayname
.
c_str
()
)
==
NULL
)
{
vtkFloatArray
*
fa
=
vtkFloatArray
::
New
();
fa
->
SetName
(
arrayname
);
fa
->
SetName
(
arrayname
.
c_str
()
);
fa
->
SetArray
(
internals
.
Data
[
cc
],
blockMesh
->
GetNumberOfCells
(),
1
);
cd
->
SetScalars
(
fa
);
cd
->
SetActiveScalars
(
"data"
);
...
...
miniapps/oscillators/dataadaptor.h
View file @
6739e88d
...
...
@@ -28,10 +28,10 @@ public:
void
SetBlockData
(
int
gid
,
float
*
data
);
virtual
vtkDataObject
*
GetMesh
(
bool
structure_only
=
false
);
virtual
bool
AddArray
(
vtkDataObject
*
mesh
,
int
association
,
const
char
*
arrayname
);
virtual
bool
AddArray
(
vtkDataObject
*
mesh
,
int
association
,
const
std
::
string
&
arrayname
);
virtual
unsigned
int
GetNumberOfArrays
(
int
)
{
return
1
;
}
virtual
const
char
*
GetArrayName
(
int
,
unsigned
int
index
)
{
return
index
==
0
?
"data"
:
NULL
;
}
virtual
std
::
string
GetArrayName
(
int
association
,
unsigned
int
index
)
{
return
index
==
0
?
"data"
:
std
::
string
()
;
}
virtual
void
ReleaseData
();
protected:
...
...
miniapps/parallel3d/DataAdaptor.cxx
View file @
6739e88d
...
...
@@ -86,9 +86,9 @@ vtkDataObject* DataAdaptor::GetMesh(bool vtkNotUsed(structure_only))
}
//-----------------------------------------------------------------------------
bool
DataAdaptor
::
AddArray
(
vtkDataObject
*
mesh
,
int
association
,
const
char
*
name
)
bool
DataAdaptor
::
AddArray
(
vtkDataObject
*
mesh
,
int
association
,
const
std
::
string
&
name
)
{
if
(
association
!=
vtkDataObject
::
FIELD_ASSOCIATION_CELLS
||
name
==
NULL
)
if
(
association
!=
vtkDataObject
::
FIELD_ASSOCIATION_CELLS
||
name
.
empty
()
)
{
return
false
;
}
...
...
@@ -107,7 +107,7 @@ bool DataAdaptor::AddArray(vtkDataObject* mesh, int association, const char* nam
{
vtkSmartPointer
<
vtkDoubleArray
>&
vtkarray
=
this
->
Arrays
[
iterV
->
first
];
vtkarray
=
vtkSmartPointer
<
vtkDoubleArray
>::
New
();
vtkarray
->
SetName
(
name
);
vtkarray
->
SetName
(
name
.
c_str
()
);
const
vtkIdType
size
=
(
this
->
CellExtent
[
1
]
-
this
->
CellExtent
[
0
]
+
1
)
*
(
this
->
CellExtent
[
3
]
-
this
->
CellExtent
[
2
]
+
1
)
*
(
this
->
CellExtent
[
5
]
-
this
->
CellExtent
[
4
]
+
1
);
...
...
@@ -127,11 +127,11 @@ unsigned int DataAdaptor::GetNumberOfArrays(int association)
}
//-----------------------------------------------------------------------------
const
char
*
DataAdaptor
::
GetArrayName
(
int
association
,
unsigned
int
index
)
std
::
string
DataAdaptor
::
GetArrayName
(
int
association
,
unsigned
int
index
)
{
if
(
association
!=
vtkDataObject
::
FIELD_ASSOCIATION_CELLS
)
{
return
NULL
;
return
""
;
}
unsigned
int
count
=
0
;
for
(
VariablesType
::
iterator
iter
=
this
->
Variables
.
begin
(),
max
=
this
->
Variables
.
end
();
...
...
@@ -139,10 +139,10 @@ const char* DataAdaptor::GetArrayName(int association, unsigned int index)
{
if
(
count
==
index
)
{
return
iter
->
first
.
c_str
()
;
return
iter
->
first
;
}
}
return
NULL
;
return
""
;
}
//-----------------------------------------------------------------------------
...
...
miniapps/parallel3d/DataAdaptor.h
View file @
6739e88d
...
...
@@ -36,9 +36,9 @@ public:
void
ClearArrays
();
virtual
vtkDataObject
*
GetMesh
(
bool
structure_only
=
false
);
virtual
bool
AddArray
(
vtkDataObject
*
mesh
,
int
association
,
const
char
*
arrayname
);
virtual
bool
AddArray
(
vtkDataObject
*
mesh
,
int
association
,
const
std
::
string
&
arrayname
);
virtual
unsigned
int
GetNumberOfArrays
(
int
association
);
virtual
const
char
*
GetArrayName
(
int
association
,
unsigned
int
index
);
virtual
std
::
string
GetArrayName
(
int
association
,
unsigned
int
index
);
virtual
void
ReleaseData
();
protected:
...
...
sensei/Autocorrelation.cxx
View file @
6739e88d
...
...
@@ -190,9 +190,9 @@ Autocorrelation::~Autocorrelation()
}
//-----------------------------------------------------------------------------
void
Autocorrelation
::
Initialize
(
MPI_Comm
world
,
size_t
window
,
int
association
,
const
char
*
arrayname
,
size_t
kmax
)
void
Autocorrelation
::
Initialize
(
MPI_Comm
world
,
size_t
window
,
int
association
,
std
::
string
&
arrayname
,
size_t
kmax
)
{
timer
::
MarkEvent
mark
(
"autocorrelation::initialize"
);
AInternals
&
internals
=
(
*
this
->
Internals
);
...
...
@@ -214,7 +214,7 @@ bool Autocorrelation::Execute(DataAdaptor* data)
const
char
*
arrayname
=
internals
.
ArrayName
.
c_str
();
vtkDataObject
*
mesh
=
data
->
GetMesh
(
/*structure-only*/
true
);
if
(
!
data
->
AddArray
(
mesh
,
association
,
a
rray
n
ame
))
if
(
!
data
->
AddArray
(
mesh
,
association
,
internals
.
A
rray
N
ame
))
{
return
false
;
}
...
...
sensei/Autocorrelation.h
View file @
6739e88d
...
...
@@ -3,6 +3,7 @@
#include "AnalysisAdaptor.h"
#include <mpi.h>
#include <string>
namespace
sensei
{
...
...
@@ -29,8 +30,9 @@ public:
/// @param arrayname together with \c association, identifies the array to
/// compute autocorrelation for.
/// @param k_max number of strongest autocorrelations to report
void
Initialize
(
MPI_Comm
world
,
size_t
window
,
int
association
,
const
char
*
arrayname
,
size_t
k_max
);
void
Initialize
(
MPI_Comm
world
,
size_t
window
,
int
association
,
std
::
string
&
arrayname
,
size_t
k_max
);
virtual
bool
Execute
(
DataAdaptor
*
data
);
protected:
...
...
sensei/ConfigurableAnalysis.cxx
View file @
6739e88d
...
...
@@ -194,10 +194,11 @@ public:
return
-
1
;
vtkNew
<
Autocorrelation
>
adaptor
;
std
::
string
arrayname
=
node
.
attribute
(
"array"
).
value
();
adaptor
->
Initialize
(
comm
,
node
.
attribute
(
"window"
)
?
node
.
attribute
(
"window"
).
as_int
()
:
10
,
this
->
GetAssociation
(
node
.
attribute
(
"association"
)),
node
.
attribute
(
"array"
).
value
()
,
arrayname
,
node
.
attribute
(
"k-max"
)
?
node
.
attribute
(
"k-max"
).
as_int
()
:
3
);
this
->
Analyses
.
push_back
(
adaptor
.
GetPointer
());
...
...
sensei/DataAdaptor.h
View file @
6739e88d
...
...
@@ -4,6 +4,8 @@
#include "vtkObjectBase.h"
#include "vtkSetGet.h" // needed for vtkTypeMacro.
#include <string>
class
vtkAbstractArray
;
class
vtkDataObject
;
class
vtkInformation
;
...
...
@@ -47,7 +49,7 @@ public:
/// vtkDataObject::FieldAssociations or vtkDataObject::AttributeTypes.
/// @return true if array was added (or already added), false is request array
/// is not available.
virtual
bool
AddArray
(
vtkDataObject
*
mesh
,
int
association
,
const
char
*
arrayname
)
=
0
;
virtual
bool
AddArray
(
vtkDataObject
*
mesh
,
int
association
,
const
std
::
string
&
arrayname
)
=
0
;
/// @brief Return the number of field arrays available.
///
...
...
@@ -69,7 +71,7 @@ public:
/// @param index index for the array. Must be less than value returned
/// GetNumberOfArrays().
/// @return name of the array.
virtual
const
char
*
GetArrayName
(
int
association
,
unsigned
int
index
)
=
0
;
virtual
std
::
string
GetArrayName
(
int
association
,
unsigned
int
index
)
=
0
;
/// @brief Release data allocated for the current timestep.
///
...
...
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