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
Ben Boeckel
Xdmf
Commits
b5dd7763
Commit
b5dd7763
authored
May 06, 2013
by
Andrew J. Burns (Cont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes to suppress warnings when using -Wall
parent
f23f1bef
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
341 additions
and
307 deletions
+341
-307
XdmfMap.cpp
XdmfMap.cpp
+24
-24
core/XdmfArray.cpp
core/XdmfArray.cpp
+34
-36
core/XdmfCore.i
core/XdmfCore.i
+8
-37
core/XdmfCoreReader.cpp
core/XdmfCoreReader.cpp
+1
-1
core/XdmfHDF5Writer.cpp
core/XdmfHDF5Writer.cpp
+44
-43
core/XdmfHDF5WriterDSM.hpp
core/XdmfHDF5WriterDSM.hpp
+1
-0
core/XdmfHeavyDataController.cpp
core/XdmfHeavyDataController.cpp
+2
-2
core/XdmfWriter.cpp
core/XdmfWriter.cpp
+5
-5
core/tests/Cxx/TestXdmfArrayInsert.cpp
core/tests/Cxx/TestXdmfArrayInsert.cpp
+0
-6
core/tests/Cxx/TestXdmfArrayMultiDimensionalInsert.cpp
core/tests/Cxx/TestXdmfArrayMultiDimensionalInsert.cpp
+0
-9
utils/XdmfFortran.cpp
utils/XdmfFortran.cpp
+220
-142
utils/XdmfFortran.hpp
utils/XdmfFortran.hpp
+2
-2
No files found.
XdmfMap.cpp
View file @
b5dd7763
...
...
@@ -221,17 +221,17 @@ XdmfMap::populateItem(const std::map<std::string, std::string> & itemProperties,
//this needs to be changed to account for controllers being a vector now
mRemoteTaskIdsControllers
.
clear
();
for
(
int
i
=
0
;
i
<
arrayVector
[
0
]
->
getNumberHeavyDataControllers
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
arrayVector
[
0
]
->
getNumberHeavyDataControllers
();
i
++
)
{
mRemoteTaskIdsControllers
.
push_back
(
arrayVector
[
0
]
->
getHeavyDataController
(
i
));
}
mLocalNodeIdsControllers
.
clear
();
for
(
int
i
=
0
;
i
<
arrayVector
[
1
]
->
getNumberHeavyDataControllers
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
arrayVector
[
1
]
->
getNumberHeavyDataControllers
();
i
++
)
{
mLocalNodeIdsControllers
.
push_back
(
arrayVector
[
1
]
->
getHeavyDataController
(
i
));
}
mRemoteLocalNodeIdsControllers
.
clear
();
for
(
int
i
=
0
;
i
<
arrayVector
[
2
]
->
getNumberHeavyDataControllers
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
arrayVector
[
2
]
->
getNumberHeavyDataControllers
();
i
++
)
{
mRemoteLocalNodeIdsControllers
.
push_back
(
arrayVector
[
2
]
->
getHeavyDataController
(
i
));
}
...
...
@@ -246,18 +246,18 @@ XdmfMap::read()
mRemoteTaskIdsControllers
.
size
()
>
0
&&
mRemoteLocalNodeIdsControllers
.
size
()
>
0
)
{
int
localNodeCount
=
0
;
for
(
int
i
=
0
;
i
<
mLocalNodeIdsControllers
.
size
();
i
++
)
unsigned
int
localNodeCount
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
mLocalNodeIdsControllers
.
size
();
i
++
)
{
localNodeCount
+=
mLocalNodeIdsControllers
[
i
]
->
getSize
();
}
int
remoteTaskCount
=
0
;
for
(
int
i
=
0
;
i
<
mRemoteTaskIdsControllers
.
size
();
i
++
)
unsigned
int
remoteTaskCount
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
mRemoteTaskIdsControllers
.
size
();
i
++
)
{
remoteTaskCount
+=
mRemoteTaskIdsControllers
[
i
]
->
getSize
();
}
int
remoteNodeCount
=
0
;
for
(
int
i
=
0
;
i
<
mRemoteLocalNodeIdsControllers
.
size
();
i
++
)
unsigned
int
remoteNodeCount
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
mRemoteLocalNodeIdsControllers
.
size
();
i
++
)
{
remoteNodeCount
+=
mRemoteLocalNodeIdsControllers
[
i
]
->
getSize
();
}
...
...
@@ -280,21 +280,21 @@ XdmfMap::read()
shared_ptr
<
XdmfArray
>
remoteLocalNodeIds
=
XdmfArray
::
New
();
mRemoteTaskIdsControllers
[
0
]
->
read
(
remoteTaskIds
.
get
());
for
(
int
i
=
1
;
i
<
mRemoteTaskIdsControllers
.
size
();
i
++
)
for
(
unsigned
int
i
=
1
;
i
<
mRemoteTaskIdsControllers
.
size
();
i
++
)
{
shared_ptr
<
XdmfArray
>
tempArray
=
XdmfArray
::
New
();
mRemoteTaskIdsControllers
[
i
]
->
read
(
tempArray
.
get
());
remoteTaskIds
->
insert
(
remoteTaskIds
->
getSize
(),
tempArray
,
0
,
tempArray
->
getSize
());
}
mLocalNodeIdsControllers
[
0
]
->
read
(
localNodeIds
.
get
());
for
(
int
i
=
1
;
i
<
mLocalNodeIdsControllers
.
size
();
i
++
)
for
(
unsigned
int
i
=
1
;
i
<
mLocalNodeIdsControllers
.
size
();
i
++
)
{
shared_ptr
<
XdmfArray
>
tempArray
=
XdmfArray
::
New
();
mLocalNodeIdsControllers
[
i
]
->
read
(
tempArray
.
get
());
localNodeIds
->
insert
(
localNodeIds
->
getSize
(),
tempArray
,
0
,
tempArray
->
getSize
());
}
mRemoteLocalNodeIdsControllers
[
0
]
->
read
(
remoteLocalNodeIds
.
get
());
for
(
int
i
=
1
;
i
<
mRemoteLocalNodeIdsControllers
.
size
();
i
++
)
for
(
unsigned
int
i
=
1
;
i
<
mRemoteLocalNodeIdsControllers
.
size
();
i
++
)
{
shared_ptr
<
XdmfArray
>
tempArray
=
XdmfArray
::
New
();
mRemoteLocalNodeIdsControllers
[
i
]
->
read
(
tempArray
.
get
());
...
...
@@ -323,18 +323,18 @@ XdmfMap::setHeavyDataControllers(std::vector<shared_ptr<XdmfHeavyDataController>
std
::
vector
<
shared_ptr
<
XdmfHeavyDataController
>
>
localNodeIdsControllers
,
std
::
vector
<
shared_ptr
<
XdmfHeavyDataController
>
>
remoteLocalNodeIdsControllers
)
{
int
localNodeCount
=
0
;
for
(
int
i
=
0
;
i
<
localNodeIdsControllers
.
size
();
i
++
)
unsigned
int
localNodeCount
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
localNodeIdsControllers
.
size
();
i
++
)
{
localNodeCount
+=
localNodeIdsControllers
[
i
]
->
getSize
();
}
int
remoteTaskCount
=
0
;
for
(
int
i
=
0
;
i
<
remoteTaskIdsControllers
.
size
();
i
++
)
unsigned
int
remoteTaskCount
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
remoteTaskIdsControllers
.
size
();
i
++
)
{
remoteTaskCount
+=
remoteTaskIdsControllers
[
i
]
->
getSize
();
}
int
remoteNodeCount
=
0
;
for
(
int
i
=
0
;
i
<
remoteLocalNodeIdsControllers
.
size
();
i
++
)
unsigned
int
remoteNodeCount
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
remoteLocalNodeIdsControllers
.
size
();
i
++
)
{
remoteNodeCount
+=
remoteLocalNodeIdsControllers
[
i
]
->
getSize
();
}
...
...
@@ -396,15 +396,15 @@ XdmfMap::traverse(const shared_ptr<XdmfBaseVisitor> visitor)
}
}
for
(
int
i
=
0
;
i
<
mRemoteTaskIdsControllers
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
mRemoteTaskIdsControllers
.
size
();
i
++
)
{
remoteTaskIds
->
insert
(
mRemoteTaskIdsControllers
[
i
]);
}
for
(
int
i
=
0
;
i
<
mLocalNodeIdsControllers
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
mLocalNodeIdsControllers
.
size
();
i
++
)
{
localNodeIds
->
insert
(
mLocalNodeIdsControllers
[
i
]);
}
for
(
int
i
=
0
;
i
<
mRemoteLocalNodeIdsControllers
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
mRemoteLocalNodeIdsControllers
.
size
();
i
++
)
{
remoteLocalNodeIds
->
insert
(
mRemoteLocalNodeIdsControllers
[
i
]);
}
...
...
@@ -417,15 +417,15 @@ XdmfMap::traverse(const shared_ptr<XdmfBaseVisitor> visitor)
mRemoteTaskIdsControllers
.
clear
();
mRemoteLocalNodeIdsControllers
.
clear
();
for
(
int
i
=
0
;
i
<
remoteTaskIds
->
getNumberHeavyDataControllers
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
remoteTaskIds
->
getNumberHeavyDataControllers
();
i
++
)
{
mRemoteTaskIdsControllers
.
push_back
(
remoteTaskIds
->
getHeavyDataController
(
i
));
}
for
(
int
i
=
0
;
i
<
localNodeIds
->
getNumberHeavyDataControllers
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
localNodeIds
->
getNumberHeavyDataControllers
();
i
++
)
{
mLocalNodeIdsControllers
.
push_back
(
localNodeIds
->
getHeavyDataController
(
i
));
}
for
(
int
i
=
0
;
i
<
remoteLocalNodeIds
->
getNumberHeavyDataControllers
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
remoteLocalNodeIds
->
getNumberHeavyDataControllers
();
i
++
)
{
mRemoteLocalNodeIdsControllers
.
push_back
(
remoteLocalNodeIds
->
getHeavyDataController
(
i
));
}
...
...
core/XdmfArray.cpp
View file @
b5dd7763
...
...
@@ -539,7 +539,7 @@ public:
{
if
(
mArray
->
mHeavyDataControllers
.
size
()
>
0
)
{
int
total
=
0
;
for
(
int
i
=
0
;
i
<
mArray
->
mHeavyDataControllers
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
mArray
->
mHeavyDataControllers
.
size
();
i
++
)
{
total
+=
mArray
->
mHeavyDataControllers
[
i
]
->
getSize
();
}
return
total
;
...
...
@@ -613,7 +613,7 @@ XdmfArray::evaluateExpression(std::string expression, std::map<std::string, shar
//string is parsed left to right
//elements of the same priority are evaluated right to left
for
(
int
i
=
0
;
i
<
expression
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
expression
.
size
();
i
++
)
{
if
(
mValidDigitChars
.
find
(
expression
[
i
])
!=
std
::
string
::
npos
)
{
//found to be a digit
//progress until a non-digit is found
int
valueStart
=
i
;
...
...
@@ -880,13 +880,12 @@ XdmfArray::addOperation(char newoperator, shared_ptr<XdmfArray>(*operationref)(s
else
{
//build the operation
//add operation to the supported character string
mSupportedOperations
.
push_back
(
newoperator
);
int
priorityArraySize
=
sizeof
(
mOperationPriority
)
/
sizeof
(
int
);
unsigned
int
priorityArraySize
=
sizeof
(
mOperationPriority
)
/
sizeof
(
int
);
if
(
mSupportedOperations
.
size
()
-
1
>
priorityArraySize
)
{
//first check to see if the priority array is large enough
//if it isn't make it bigger, double size should be fine
int
newArray
[
priorityArraySize
*
2
];
std
::
copy
(
mOperationPriority
,
mOperationPriority
+
(
priorityArraySize
-
1
),
newArray
);
delete
mOperationPriority
;
*
mOperationPriority
=
*
newArray
;
*
mOperationPriority
=
*
newArray
;
}
size_t
priorityLocation
=
mSupportedOperations
.
find
(
newoperator
);
mOperationPriority
[
priorityLocation
]
=
priority
;
...
...
@@ -1161,8 +1160,8 @@ XdmfArray::interlace(shared_ptr<XdmfArray> val1, shared_ptr<XdmfArray> val2)
returnArray
->
resize
(
val1
->
getSize
()
+
val2
->
getSize
(),
sampleValue
);
}
//determine ratio of array sizes
int
arrayRatio1
=
floor
(
static_cast
<
double
>
(
val1
->
getSize
())
/
val2
->
getSize
());
int
arrayRatio2
=
floor
(
static_cast
<
double
>
(
val2
->
getSize
())
/
val1
->
getSize
());
int
arrayRatio1
=
(
int
)
floor
(
static_cast
<
double
>
(
val1
->
getSize
())
/
val2
->
getSize
());
int
arrayRatio2
=
(
int
)
floor
(
static_cast
<
double
>
(
val2
->
getSize
())
/
val1
->
getSize
());
if
(
arrayRatio1
<
1
)
{
arrayRatio1
=
1
;
}
...
...
@@ -1178,23 +1177,23 @@ XdmfArray::interlace(shared_ptr<XdmfArray> val1, shared_ptr<XdmfArray> val2)
//first array gets the first value of the new array
if
(
i
<
arrayRatio1
)
{
int
amountWritten
=
val1
->
getSize
()
/
arrayRatio1
;
if
(((
amountWritten
*
arrayRatio1
)
+
i
)
<
val1
->
getSize
())
{
if
(((
amountWritten
*
arrayRatio1
)
+
i
)
<
(
int
)
val1
->
getSize
())
{
amountWritten
++
;
}
if
(
amountWritten
>
floor
(
val2
->
getSize
()
/
arrayRatio2
))
{
arrayExcess1
+=
amountWritten
-
floor
(
val2
->
getSize
()
/
arrayRatio2
);
amountWritten
=
floor
(
val2
->
getSize
()
/
arrayRatio2
);
arrayExcess1
+=
amountWritten
-
(
int
)
floor
(
val2
->
getSize
()
/
arrayRatio2
);
amountWritten
=
(
int
)
floor
(
val2
->
getSize
()
/
arrayRatio2
);
}
returnArray
->
insert
(
i
,
val1
,
i
,
amountWritten
,
stride
,
arrayRatio1
);
}
else
{
//second array takes the rest
int
amountWritten
=
val2
->
getSize
()
/
arrayRatio2
;
if
(((
amountWritten
*
arrayRatio2
)
+
i
)
<
val2
->
getSize
())
{
if
(((
amountWritten
*
arrayRatio2
)
+
i
)
<
(
int
)
val2
->
getSize
())
{
amountWritten
++
;
}
if
(
amountWritten
>
floor
(
val1
->
getSize
()
/
arrayRatio1
))
{
arrayExcess2
+=
amountWritten
-
floor
(
val1
->
getSize
()
/
arrayRatio1
);
amountWritten
=
floor
(
val1
->
getSize
()
/
arrayRatio1
);
arrayExcess2
+=
amountWritten
-
(
int
)
floor
(
val1
->
getSize
()
/
arrayRatio1
);
amountWritten
=
(
int
)
floor
(
val1
->
getSize
()
/
arrayRatio1
);
}
returnArray
->
insert
(
i
,
val2
,
i
-
arrayRatio1
,
amountWritten
,
stride
,
arrayRatio2
);
}
...
...
@@ -1226,7 +1225,7 @@ int
XdmfArray
::
addFunction
(
std
::
string
name
,
shared_ptr
<
XdmfArray
>
(
*
functionref
)(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
))
{
//check to ensure that the name has valid characters
for
(
int
i
=
0
;
i
<
name
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
name
.
size
();
i
++
)
{
if
(
mValidVariableChars
.
find
(
name
[
i
])
==
std
::
string
::
npos
)
{
//if the character is not found in the list of valid characters
//then throw an error
try
{
...
...
@@ -1257,8 +1256,8 @@ shared_ptr<XdmfArray>
XdmfArray
::
sum
(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
values
)
{
double
total
=
0.0
;
for
(
int
i
=
0
;
i
<
values
.
size
();
i
++
)
{
for
(
int
j
=
0
;
j
<
values
[
i
]
->
getSize
();
j
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
values
.
size
();
i
++
)
{
for
(
unsigned
int
j
=
0
;
j
<
values
[
i
]
->
getSize
();
j
++
)
{
total
+=
values
[
i
]
->
getValue
<
double
>
(
j
);
}
}
...
...
@@ -1272,7 +1271,7 @@ XdmfArray::ave(std::vector<shared_ptr<XdmfArray> > values)
{
double
total
=
sum
(
values
)
->
getValue
<
double
>
(
0
);;
int
totalSize
=
0
;
for
(
int
i
=
0
;
i
<
values
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
values
.
size
();
i
++
)
{
totalSize
+=
values
[
i
]
->
getSize
();
}
...
...
@@ -1310,9 +1309,9 @@ XdmfArray::getDimensions() const
std
::
vector
<
unsigned
int
>
tempDimensions
;
//find the controller with the most dimensions
int
dimControllerIndex
=
0
;
int
dimSizeMax
=
0
;
unsigned
int
dimSizeMax
=
0
;
unsigned
int
dimTotal
=
0
;
for
(
int
i
=
0
;
i
<
mHeavyDataControllers
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
mHeavyDataControllers
.
size
();
i
++
)
{
dimTotal
+=
mHeavyDataControllers
[
i
]
->
getSize
();
if
(
mHeavyDataControllers
[
i
]
->
getSize
()
>
dimSizeMax
)
{
dimSizeMax
=
mHeavyDataControllers
[
i
]
->
getSize
();
...
...
@@ -1321,7 +1320,7 @@ XdmfArray::getDimensions() const
}
//total up the size of the lower dimensions
int
controllerDimensionSubtotal
=
1
;
for
(
int
i
=
0
;
i
<
mHeavyDataControllers
[
dimControllerIndex
]
->
getDimensions
().
size
()
-
1
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
mHeavyDataControllers
[
dimControllerIndex
]
->
getDimensions
().
size
()
-
1
;
i
++
)
{
returnDimensions
.
push_back
(
mHeavyDataControllers
[
dimControllerIndex
]
->
getDimensions
()[
i
]);
controllerDimensionSubtotal
*=
mHeavyDataControllers
[
dimControllerIndex
]
->
getDimensions
()[
i
];
}
...
...
@@ -1566,12 +1565,12 @@ XdmfArray::insert(const std::vector<unsigned int> startIndex,
//pull data from values
std
::
vector
<
unsigned
int
>
dimTotalVector
;
unsigned
int
dimTotal
=
1
;
for
(
int
i
=
0
;
i
<
values
->
getDimensions
().
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
values
->
getDimensions
().
size
();
i
++
)
{
dimTotalVector
.
push_back
(
dimTotal
);
dimTotal
*=
values
->
getDimensions
()[
i
];
}
std
::
vector
<
int
>
indexVector
;
for
(
int
i
=
0
;
i
<
values
->
getDimensions
().
size
();
i
++
)
{
std
::
vector
<
unsigned
int
>
indexVector
;
for
(
unsigned
int
i
=
0
;
i
<
values
->
getDimensions
().
size
();
i
++
)
{
indexVector
.
push_back
(
0
);
}
shared_ptr
<
XdmfArray
>
holderArray
=
XdmfArray
::
New
();
...
...
@@ -1580,7 +1579,7 @@ XdmfArray::insert(const std::vector<unsigned int> startIndex,
//initialize the section of the array you're pulling from
unsigned
int
startTotal
=
0
;
dimTotal
=
1
;
for
(
int
i
=
0
;
i
<
values
->
getDimensions
().
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
values
->
getDimensions
().
size
();
i
++
)
{
if
(
i
==
0
)
{
//stride doesn't factor in to the first dimension since it's being used with the insert call
startTotal
+=
valuesStartIndex
[
i
]
*
dimTotal
;
}
...
...
@@ -1594,7 +1593,7 @@ XdmfArray::insert(const std::vector<unsigned int> startIndex,
holderoffset
+=
numValues
[
0
];
//increment up the vector
bool
increment
=
true
;
for
(
int
i
=
0
;
i
<
indexVector
.
size
()
&&
increment
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
indexVector
.
size
()
&&
increment
;
i
++
)
{
indexVector
[
i
]
++
;
if
(
i
+
1
<
numValues
.
size
())
{
//to keep the loop from breaking at the end
if
(
indexVector
[
i
]
>=
numValues
[
i
+
1
])
{
...
...
@@ -1610,7 +1609,7 @@ XdmfArray::insert(const std::vector<unsigned int> startIndex,
//use an variation of the last loop to insert into this array
indexVector
.
clear
();
for
(
int
i
=
0
;
i
<
this
->
getDimensions
().
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
this
->
getDimensions
().
size
();
i
++
)
{
indexVector
.
push_back
(
0
);
}
holderoffset
=
0
;
...
...
@@ -1618,7 +1617,7 @@ XdmfArray::insert(const std::vector<unsigned int> startIndex,
//initialize the section of the array you're pulling from
unsigned
int
startTotal
=
0
;
dimTotal
=
1
;
for
(
int
i
=
0
;
i
<
this
->
getDimensions
().
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
this
->
getDimensions
().
size
();
i
++
)
{
if
(
i
==
0
)
{
//stride doesn't factor in to the first dimension since it's being used with the insert call
startTotal
+=
startIndex
[
i
]
*
dimTotal
;
}
...
...
@@ -1632,7 +1631,7 @@ XdmfArray::insert(const std::vector<unsigned int> startIndex,
holderoffset
+=
numInserted
[
0
];
//increment up the vector
bool
increment
=
true
;
for
(
int
i
=
0
;
i
<
indexVector
.
size
()
&&
increment
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
indexVector
.
size
()
&&
increment
;
i
++
)
{
indexVector
[
i
]
++
;
if
(
i
+
1
<
numInserted
.
size
())
{
//to keep the loop from breaking at the end
if
(
indexVector
[
i
]
>=
numInserted
[
i
+
1
])
{
...
...
@@ -1664,7 +1663,6 @@ XdmfArray::insert(const std::vector<unsigned int> startIndex,
catch
(
XdmfError
e
)
{
throw
e
;
}
}
}
}
...
...
@@ -1712,7 +1710,7 @@ XdmfArray::populateItem(const std::map<std::string, std::string> & itemPropertie
std
::
vector
<
std
::
string
>
contentVals
;
contentVals
.
push_back
(
content
->
second
);
int
contentIndex
=
1
;
unsigned
int
contentIndex
=
1
;
bool
endOfContent
=
false
;
...
...
@@ -1799,7 +1797,7 @@ XdmfArray::populateItem(const std::map<std::string, std::string> & itemPropertie
}
else
{
//if it fails then it means that the next content is not a dimension string
//in this case it is assumed that the controller will have dimensions equal to the array
for
(
int
j
=
0
;
j
<
mDimensions
.
size
();
j
++
)
{
for
(
unsigned
int
j
=
0
;
j
<
mDimensions
.
size
();
j
++
)
{
contentDims
.
push_back
(
mDimensions
[
j
]);
}
contentStep
=
1
;
...
...
@@ -1869,11 +1867,11 @@ XdmfArray::read()
{
if
(
mHeavyDataControllers
.
size
()
>
0
)
{
this
->
release
();
for
(
int
i
=
0
;
i
<
mHeavyDataControllers
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
mHeavyDataControllers
.
size
();
i
++
)
{
shared_ptr
<
XdmfArray
>
tempArray
=
XdmfArray
::
New
();
mHeavyDataControllers
[
i
]
->
read
(
tempArray
.
get
());
unsigned
int
dimTotal
=
1
;
for
(
int
j
=
0
;
j
<
mHeavyDataControllers
[
i
]
->
getDimensions
().
size
();
j
++
)
{
for
(
unsigned
int
j
=
0
;
j
<
mHeavyDataControllers
[
i
]
->
getDimensions
().
size
();
j
++
)
{
dimTotal
*=
mHeavyDataControllers
[
i
]
->
getDimensions
()[
j
];
}
this
->
insert
(
mHeavyDataControllers
[
i
]
->
getArrayOffset
(),
tempArray
,
0
,
dimTotal
,
1
,
1
);
...
...
@@ -1882,9 +1880,9 @@ XdmfArray::read()
std
::
vector
<
unsigned
int
>
tempDimensions
;
//find the controller with the most dimensions
int
dimControllerIndex
=
0
;
int
dimSizeMax
=
0
;
unsigned
int
dimSizeMax
=
0
;
unsigned
int
dimTotal
=
0
;
for
(
int
i
=
0
;
i
<
mHeavyDataControllers
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
mHeavyDataControllers
.
size
();
i
++
)
{
dimTotal
+=
mHeavyDataControllers
[
i
]
->
getSize
();
if
(
mHeavyDataControllers
[
i
]
->
getSize
()
>
dimSizeMax
)
{
dimSizeMax
=
mHeavyDataControllers
[
i
]
->
getSize
();
...
...
@@ -1893,7 +1891,7 @@ XdmfArray::read()
}
//total up the size of the lower dimensions
int
controllerDimensionSubtotal
=
1
;
for
(
int
i
=
0
;
i
<
mHeavyDataControllers
[
dimControllerIndex
]
->
getDimensions
().
size
()
-
1
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
mHeavyDataControllers
[
dimControllerIndex
]
->
getDimensions
().
size
()
-
1
;
i
++
)
{
returnDimensions
.
push_back
(
mHeavyDataControllers
[
dimControllerIndex
]
->
getDimensions
()[
i
]);
controllerDimensionSubtotal
*=
mHeavyDataControllers
[
dimControllerIndex
]
->
getDimensions
()[
i
];
}
...
...
core/XdmfCore.i
View file @
b5dd7763
...
...
@@ -190,13 +190,13 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i
%
extend
XdmfArray
{
%
{
#
include
<
stack
>
;
/*These can't be accessed from python so don't worry about security issues.*/
#
include
<
stack
>
static
std
::
map
<
std
::
string
,
PyObject
*>
pythonFunctions
;
static
std
::
map
<
char
,
PyObject
*>
pythonOperations
;
static
int
pythonOperationPriority
[
4
]
;
static
std
::
string
pythonSupportedOperations
=
""
;
%
}
/*These can't be accessed from python so don't worry about security issues.*/
PyObject
*
getBuffer
()
{
void
*
vp
=
$
self-
>
getValuesInternal
()
;
...
...
@@ -329,15 +329,6 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i
/*note, accessing private members is impossible from swig.*/
/*to generate new static functions mark them as static here.*/
static
std
::
vector
<
std
::
string
>
getSupportedFunctions
()
{
std
::
vector
<
std
::
string
>
returnVector
=
XdmfArray
::
getSupportedFunctions
()
;
for
(
std
::
map
<
std
::
string
,
PyObject
*>::
iterator
functionWalker
=
pythonFunctions
.
begin
()
;
functionWalker
!=
pythonFunctions
.
end
()
;
functionWalker
++
)
{
returnVector
.
push_back
(
functionWalker-
>
first
)
;
}
return
returnVector
;
}
static
shared_ptr
<
XdmfArray
>
evaluateFunction
(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
functValues
,
std
::
string
functName
)
{
if
(
pythonFunctions
.
find
(
functName
)
!=
pythonFunctions
.
end
())
{
...
...
@@ -359,24 +350,6 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i
}
}
static
std
::
string
getSupportedOperations
()
{
std
::
string
returnVector
=
XdmfArray
::
getSupportedOperations
()
;
returnVector
+=
pythonSupportedOperations
;
return
returnVector
;
}
static
int
getOperationPriority
(
char
operation
)
{
size_t
operationLocation
=
pythonSupportedOperations
.
find
(
operation
)
;
if
(
operationLocation
!=
std
::
string
::
npos
)
{
return
pythonOperationPriority
[
operationLocation
]
;
}
else
{
return
XdmfArray
::
getOperationPriority
(
operation
)
;
}
}
static
shared_ptr
<
XdmfArray
>
evaluateOperation
(
shared_ptr
<
XdmfArray
>
val1
,
shared_ptr
<
XdmfArray
>
val2
,
char
functName
)
{
if
(
pythonOperations
.
find
(
functName
)
!=
pythonOperations
.
end
())
{
...
...
@@ -407,7 +380,7 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i
/*string is parsed left to right
elements of the same priority are evaluated right to left*/
for
(
int
i
=
0
;
i
<
expression
.
size
()
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
expression
.
size
()
;
i
++
)
{
if
(
XdmfArray
::
getValidDigitChars
()
.
find
(
expression
[
i
])
!=
std
::
string
::
npos
)
{
/*found to be a digit*/
/*progress until a non-digit is found*/
int
valueStart
=
i
;
...
...
@@ -429,7 +402,7 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i
if
(
variables
.
find
(
expression
.
substr
(
valueStart
,
i
+
1
-
valueStart
))
==
variables
.
end
())
{
std
::
vector
<
std
::
string
>
functionList
=
XdmfArray
::
getSupportedFunctions
()
;
bool
functionExists
=
false
;
for
(
int
j
=
0
;
j
<
functionList
.
size
()
&
&
!functionExists;
j++)
{
for
(
unsigned
int
j
=
0
;
j
<
functionList
.
size
()
&
&
!functionExists;
j++)
{
if
(
functionList
[
j
]
==
expression
.
substr
(
valueStart
,
i
+
1
-
valueStart
))
{
functionExists
=
true
;
}
...
...
@@ -647,11 +620,10 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i
/*if not an already defined python function*/
if
(
pythonOperations
.
find
(
newName
)
==
pythonOperations
.
end
())
{
pythonSupportedOperations
.
push_back
(
newName
)
;
int
priorityArraySize
=
sizeof
(
pythonOperationPriority
)
/
sizeof
(
int
)
;
unsigned
int
priorityArraySize
=
sizeof
(
pythonOperationPriority
)
/
sizeof
(
int
)
;
if
(
pythonSupportedOperations
.
size
()
-
1
>
priorityArraySize
)
{
int
newArray
[
priorityArraySize
*
2
]
;
std
::
copy
(
pythonOperationPriority
,
pythonOperationPriority
+
(
priorityArraySize-1
),
newArray
)
;
delete
pythonOperationPriority
;
*
pythonOperationPriority
=
*
newArray
;
}
}
...
...
@@ -666,12 +638,11 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i
}
else
{
pythonSupportedOperations
.
push_back
(
newName
)
;
int
priorityArraySize
=
sizeof
(
pythonOperationPriority
)
/
sizeof
(
int
)
;
unsigned
int
priorityArraySize
=
sizeof
(
pythonOperationPriority
)
/
sizeof
(
int
)
;
if
(
pythonSupportedOperations
.
size
()
-
1
>
priorityArraySize
)
{
int
newArray
[
priorityArraySize
*
2
]
;
std
::
copy
(
pythonOperationPriority
,
pythonOperationPriority
+
(
priorityArraySize-1
),
newArray
)
;
delete
pythonOperationPriority
;
*
pythonOperationPriority
=
*
newArray
;
}
}
...
...
@@ -725,7 +696,7 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i
/*string is parsed left to right
elements of the same priority are evaluated right to left*/
for
(
int
i
=
0
;
i
<
expression
.
size
()
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
expression
.
size
()
;
i
++
)
{
if
(
XdmfArray
::
getValidDigitChars
()
.
find
(
expression
[
i
])
!=
std
::
string
::
npos
)
{
/*found to be a digit*/
/*progress until a non-digit is found*/
int
valueStart
=
i
;
...
...
@@ -747,7 +718,7 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i
if
(
variables
.
find
(
expression
.
substr
(
valueStart
,
i
+
1
-
valueStart
))
==
variables
.
end
())
{
std
::
vector
<
std
::
string
>
functionList
=
XdmfArray
::
getSupportedFunctions
()
;
bool
functionExists
=
false
;
for
(
int
j
=
0
;
j
<
functionList
.
size
()
&
&
!functionExists;
j++)
{
for
(
unsigned
int
j
=
0
;
j
<
functionList
.
size
()
&
&
!functionExists;
j++)
{
if
(
functionList
[
j
]
==
expression
.
substr
(
valueStart
,
i
+
1
-
valueStart
))
{
functionExists
=
true
;
}
...
...
core/XdmfCoreReader.cpp
View file @
b5dd7763
...
...
@@ -387,7 +387,7 @@ public:
//insert those controllers into the childArray
int
hdf5step
=
2
;
for
(
int
i
=
0
;
i
<
controllerParts
.
size
();
i
=
i
+
hdf5step
)
{
for
(
unsigned
int
i
=
0
;
i
<
controllerParts
.
size
();
i
=
i
+
hdf5step
)
{
size_t
colonLocation
=
controllerParts
[
i
].
find
(
":"
);
if
(
colonLocation
==
std
::
string
::
npos
)
{
try
{
...
...
core/XdmfHDF5Writer.cpp
View file @
b5dd7763
This diff is collapsed.
Click to expand it.
core/XdmfHDF5WriterDSM.hpp
View file @
b5dd7763
...
...
@@ -331,6 +331,7 @@ public:
void
openFile
();
using
XdmfHeavyDataWriter
::
visit
;
void
visit
(
XdmfArray
&
array
,
const
shared_ptr
<
XdmfBaseVisitor
>
visitor
);
...
...
core/XdmfHeavyDataController.cpp
View file @
b5dd7763
...
...
@@ -40,8 +40,8 @@ XdmfHeavyDataController::XdmfHeavyDataController(const std::string & filePath,
mFilePath
(
filePath
),
mStart
(
start
),
mStride
(
stride
),
m
Type
(
type
),
m
ArrayStartOffset
(
0
)
m
ArrayStartOffset
(
0
),
m
Type
(
type
)
{
if
(
!
(
mStart
.
size
()
==
mStride
.
size
()
&&
mStride
.
size
()
==
mDimensions
.
size
()))
...
...
core/XdmfWriter.cpp
View file @
b5dd7763
...
...
@@ -317,7 +317,7 @@ XdmfWriter::visit(XdmfArray & array,
throw
e
;
}
std
::
stringstream
valuesStream
;
for
(
int
i
=
0
;
i
<
array
.
getNumberHeavyDataControllers
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
array
.
getNumberHeavyDataControllers
();
i
++
)
{
std
::
string
heavyDataPath
=
array
.
getHeavyDataController
(
i
)
->
getFilePath
();
size_t
index
=
heavyDataPath
.
find_last_of
(
"/
\\
"
);
...
...
@@ -330,7 +330,7 @@ XdmfWriter::visit(XdmfArray & array,
}
//otherwise the full path is required
}
std
::
stringstream
dimensionStream
;
for
(
int
j
=
0
;
j
<
array
.
getHeavyDataController
(
i
)
->
getDimensions
().
size
();
j
++
)
{
for
(
unsigned
int
j
=
0
;
j
<
array
.
getHeavyDataController
(
i
)
->
getDimensions
().
size
();
j
++
)
{
dimensionStream
<<
array
.
getHeavyDataController
(
i
)
->
getDimensions
()[
j
];
if
(
j
<
array
.
getHeavyDataController
(
i
)
->
getDimensions
().
size
()
-
1
)
{
dimensionStream
<<
" "
;
...
...
@@ -366,7 +366,7 @@ XdmfWriter::visit(XdmfArray & array,
array
.
swap
(
arrayToWrite
);
mImpl
->
mXMLCurrentNode
=
mImpl
->
mXMLCurrentNode
->
last
;
this
->
visit
(
dynamic_cast
<
XdmfItem
&>
(
*
arrayToWrite
.
get
()),
visitor
);
for
(
int
i
=
0
;
i
<
xmlTextValues
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
xmlTextValues
.
size
();
i
++
)
{
xmlAddChild
(
mImpl
->
mXMLCurrentNode
->
last
,
xmlNewText
((
xmlChar
*
)
xmlTextValues
[
i
].
c_str
()));
}
...
...
@@ -375,7 +375,7 @@ XdmfWriter::visit(XdmfArray & array,
}
else
{
this
->
visit
(
dynamic_cast
<
XdmfItem
&>
(
array
),
visitor
);
for
(
int
i
=
0
;
i
<
xmlTextValues
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
xmlTextValues
.
size
();
i
++
)
{
xmlAddChild
(
mImpl
->
mXMLCurrentNode
->
last
,
xmlNewText
((
xmlChar
*
)
xmlTextValues
[
i
].
c_str
()));
}
...
...
@@ -415,7 +415,7 @@ XdmfWriter::visit(XdmfItem & item,
XdmfInformation
&
xpathinfo
=
dynamic_cast
<
XdmfInformation
&>
(
item
);
if
(
xpathinfo
.
getKey
()
==
"XIncludes"
)
{
shared_ptr
<
XdmfInformation
>
outputinfo
;
for
(
int
i
=
0
;
i
<
xpathinfo
.
getNumberInformations
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
xpathinfo
.
getNumberInformations
();
i
++
)
{
mImpl
->
mXPathCount
++
;
outputinfo
=
xpathinfo
.
getInformation
(
i
);
mImpl
->
mXMLCurrentNode
=
xmlNewChild
(
mImpl
->
mXMLCurrentNode
,
...
...
core/tests/Cxx/TestXdmfArrayInsert.cpp
View file @
b5dd7763
...
...
@@ -20,8 +20,6 @@ int main(int, char **)
array1
->
insert
(
2
,
insertArray3
,
0
,
10
,
4
,
1
);
array1
->
insert
(
3
,
insertArray4
,
0
,
10
,
4
,
1
);
printf
(
"array1 contains
\n
%s
\n
"
,
array1
->
getValuesString
());
assert
(
array1
->
getValuesString
().
compare
(
"1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 "
"2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 "
"3 4 1 2 3 4"
)
==
0
);
...
...
@@ -39,8 +37,6 @@ int main(int, char **)
array2
->
insert
(
2
,
&
(
insertArray7
[
0
]),
10
,
4
,
1
);
array2
->
insert
(
3
,
&
(
insertArray8
[
0
]),
10
,
4
,
1
);
printf
(
"array2 contains
\n
%s
\n
"
,
array2
->
getValuesString
());
assert
(
array2
->
getValuesString
().
compare
(
"1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 "
"2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 "
"3 4 1 2 3 4"
)
==
0
);
...
...
@@ -58,8 +54,6 @@ int main(int, char **)
array3
->
insert
(
2
,
&
(
insertArray11
[
0
]),
10
,
4
,
1
);
array3
->
insert
(
3
,
&
(
insertArray12
[
0
]),
10
,
4
,
1
);
printf
(
"array3 contains
\n
%s
\n
"
,
array3
->
getValuesString
());
assert
(
array3
->
getValuesString
().
compare
(
"1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 "
"2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 "
"3 4 1 2 3 4"
)
==
0
);
...
...
core/tests/Cxx/TestXdmfArrayMultiDimensionalInsert.cpp
View file @
b5dd7763
...
...
@@ -46,14 +46,5 @@ int main(int, char **)
assert
(
readArray
->
getValuesString
().
compare
(
"1 0 3 0 5 0 0 0 0 0 0 0 11 0 13 0 15 0 0 0 0 0 0 0"
)
==
0
);