Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xdmf
Xdmf
Commits
a72f4007
Commit
a72f4007
authored
Jun 06, 2013
by
Andrew J. Burns (Cont
Browse files
Formatting changes and removing warnings
parent
03e031e0
Changes
25
Expand all
Hide whitespace changes
Inline
Side-by-side
XdmfGraph.cpp
View file @
a72f4007
...
...
@@ -54,7 +54,7 @@ XdmfGraph::getItemTag() const
unsigned
int
XdmfGraph
::
getNumberNodes
()
const
{
//The number of nodes is equal to the number of rows or columns. Either will work.
//
The number of nodes is equal to the number of rows or columns. Either will work.
return
this
->
getNumberRows
();
}
...
...
XdmfMap.cpp
View file @
a72f4007
...
...
@@ -219,19 +219,18 @@ XdmfMap::populateItem(const std::map<std::string, std::string> & itemProperties,
}
else
{
//this needs to be changed to account for controllers being a vector now
mRemoteTaskIdsControllers
.
clear
();
for
(
unsigned
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
(
unsigned
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
(
unsigned
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
));
}
...
...
@@ -247,17 +246,17 @@ XdmfMap::read()
mRemoteLocalNodeIdsControllers
.
size
()
>
0
)
{
unsigned
int
localNodeCount
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
mLocalNodeIdsControllers
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
mLocalNodeIdsControllers
.
size
();
++
i
)
{
localNodeCount
+=
mLocalNodeIdsControllers
[
i
]
->
getSize
();
}
unsigned
int
remoteTaskCount
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
mRemoteTaskIdsControllers
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
mRemoteTaskIdsControllers
.
size
();
++
i
)
{
remoteTaskCount
+=
mRemoteTaskIdsControllers
[
i
]
->
getSize
();
}
unsigned
int
remoteNodeCount
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
mRemoteLocalNodeIdsControllers
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
mRemoteLocalNodeIdsControllers
.
size
();
++
i
)
{
remoteNodeCount
+=
mRemoteLocalNodeIdsControllers
[
i
]
->
getSize
();
}
...
...
@@ -280,21 +279,21 @@ XdmfMap::read()
shared_ptr
<
XdmfArray
>
remoteLocalNodeIds
=
XdmfArray
::
New
();
mRemoteTaskIdsControllers
[
0
]
->
read
(
remoteTaskIds
.
get
());
for
(
unsigned
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
(
unsigned
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
(
unsigned
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
());
...
...
@@ -324,17 +323,17 @@ XdmfMap::setHeavyDataControllers(std::vector<shared_ptr<XdmfHeavyDataController>
std
::
vector
<
shared_ptr
<
XdmfHeavyDataController
>
>
remoteLocalNodeIdsControllers
)
{
unsigned
int
localNodeCount
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
localNodeIdsControllers
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
localNodeIdsControllers
.
size
();
++
i
)
{
localNodeCount
+=
localNodeIdsControllers
[
i
]
->
getSize
();
}
unsigned
int
remoteTaskCount
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
remoteTaskIdsControllers
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
remoteTaskIdsControllers
.
size
();
++
i
)
{
remoteTaskCount
+=
remoteTaskIdsControllers
[
i
]
->
getSize
();
}
unsigned
int
remoteNodeCount
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
remoteLocalNodeIdsControllers
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
remoteLocalNodeIdsControllers
.
size
();
++
i
)
{
remoteNodeCount
+=
remoteLocalNodeIdsControllers
[
i
]
->
getSize
();
}
...
...
@@ -396,15 +395,15 @@ XdmfMap::traverse(const shared_ptr<XdmfBaseVisitor> visitor)
}
}
for
(
unsigned
int
i
=
0
;
i
<
mRemoteTaskIdsControllers
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
mRemoteTaskIdsControllers
.
size
();
++
i
)
{
remoteTaskIds
->
insert
(
mRemoteTaskIdsControllers
[
i
]);
}
for
(
unsigned
int
i
=
0
;
i
<
mLocalNodeIdsControllers
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
mLocalNodeIdsControllers
.
size
();
++
i
)
{
localNodeIds
->
insert
(
mLocalNodeIdsControllers
[
i
]);
}
for
(
unsigned
int
i
=
0
;
i
<
mRemoteLocalNodeIdsControllers
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
mRemoteLocalNodeIdsControllers
.
size
();
++
i
)
{
remoteLocalNodeIds
->
insert
(
mRemoteLocalNodeIdsControllers
[
i
]);
}
...
...
@@ -417,15 +416,15 @@ XdmfMap::traverse(const shared_ptr<XdmfBaseVisitor> visitor)
mRemoteTaskIdsControllers
.
clear
();
mRemoteLocalNodeIdsControllers
.
clear
();
for
(
unsigned
int
i
=
0
;
i
<
remoteTaskIds
->
getNumberHeavyDataControllers
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
remoteTaskIds
->
getNumberHeavyDataControllers
();
++
i
)
{
mRemoteTaskIdsControllers
.
push_back
(
remoteTaskIds
->
getHeavyDataController
(
i
));
}
for
(
unsigned
int
i
=
0
;
i
<
localNodeIds
->
getNumberHeavyDataControllers
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
localNodeIds
->
getNumberHeavyDataControllers
();
++
i
)
{
mLocalNodeIdsControllers
.
push_back
(
localNodeIds
->
getHeavyDataController
(
i
));
}
for
(
unsigned
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 @
a72f4007
This diff is collapsed.
Click to expand it.
core/XdmfArray.hpp
View file @
a72f4007
...
...
@@ -124,6 +124,98 @@ public:
XDMF_CHILDREN
(
XdmfArray
,
XdmfHeavyDataController
,
HeavyDataController
,
Name
);
static
const
std
::
string
ItemTag
;
/**
* Adds an operation to the list of viable operators.
*
* Example of Use:
*
* C++
*
* @dontinclude ExampleXdmfArray.cpp
* @skipline prepend
* @skipline main
* @skipline addOperation
* @skipline return
* @until }
* @skipline prepend
* @until }
*
* Python
*
* @dontinclude XdmfExampleArray.py
* @skipline prepend
* @until val2.getSize
* @skipline return
* @skipline __main__
* @skipline addOperation
*
* @param newoperator the character to be associated with the provided binary operation
* @param functionref a pointer to the function to be associated with the provided operator
* @param priority used to determine order of operations the higher the value the earlier it is evaluated
*/
static
int
addOperation
(
char
newoperator
,
shared_ptr
<
XdmfArray
>
(
*
functionref
)(
shared_ptr
<
XdmfArray
>
,
shared_ptr
<
XdmfArray
>
),
int
priority
);
/*
* adds a specified function to the list of functions used while evaluating strings
*
* C++
*
* @dontinclude ExampleXdmfArray.cpp
* @skipline maximum
* @skipline main
* @skipline addFunction
* @skipline return
* @until }
* @skipline maximum
* @until else
* @skipline {
* @until returnArray;
* @skipline }
* @until }
*
* Python
*
* @dontinclude XdmfExampleArray.py
* @skipline maximum
* @until else
* @skipline maxVal
* @until pushBackAsFloat
* @skipline return
* @skipline __main__
* @skipline addFunction
*
* @param name A string to be associated with the provided function during string evaluation
* @param functionref A pointer to the function to be associated with the given string
* @return The total number of functions currently associated
*/
static
int
addFunction
(
std
::
string
name
,
shared_ptr
<
XdmfArray
>
(
*
functionref
)(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
));
/**
* Averages the values contained in all the provided arrays.
*
* C++
*
* @dontinclude ExampleXdmfArray.cpp
* @skipline valueArray1
* @until valueVector
* @skipline valueArray1
* @until valueArray2
* @skipline ave
*
* Python
*
* @dontinclude XdmfExampleArray.py
* @skipline valueArray1
* @until valueVector
* @skipline valueArray1
* @until valueArray2
* @skipline ave
*
* @param values a vector containing the arrays to be used
* @return an XdmfArray containing one value which is the average of all values contained within the provided arrays
*/
static
shared_ptr
<
XdmfArray
>
ave
(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
values
);
/**
* Remove all values from this array.
*
...
...
@@ -143,6 +235,31 @@ public:
*/
void
clear
();
/**
* Joins the two provided arrays together end to end.
*
* Example of Use:
*
* C++
*
* @dontinclude ExampleXdmfArray.cpp
* @skipline valueArray1
* @until (6)
* @skipline chunk
*
* Python
*
* @dontinclude XdmfExampleArray.py
* @skipline valueArray1
* @until (6)
* @skipline chunk
*
* @param val1 the first array being evaluated
* @param val2 the second array being evaluated
* @return the arrays joined end to end
*/
static
shared_ptr
<
XdmfArray
>
chunk
(
shared_ptr
<
XdmfArray
>
val1
,
shared_ptr
<
XdmfArray
>
val2
);
/**
* Remove a value from this array.
*
...
...
@@ -165,12 +282,6 @@ public:
*/
void
erase
(
const
unsigned
int
index
);
/**
* Evaluates an expression based on the list of variables provided.
* A list of valid operations is retrievable from the getSupportedOperations static method.
...
...
@@ -256,86 +367,6 @@ public:
*/
static
shared_ptr
<
XdmfArray
>
evaluateOperation
(
shared_ptr
<
XdmfArray
>
val1
,
shared_ptr
<
XdmfArray
>
val2
,
char
operation
);
/**
* Adds an operation to the list of viable operators.
*
* Example of Use:
*
* C++
*
* @dontinclude ExampleXdmfArray.cpp
* @skipline prepend
* @skipline main
* @skipline addOperation
* @skipline return
* @until }
* @skipline prepend
* @until }
*
* Python
*
* @dontinclude XdmfExampleArray.py
* @skipline prepend
* @until val2.getSize
* @skipline return
* @skipline __main__
* @skipline addOperation
*
* @param newoperator the character to be associated with the provided binary operation
* @param functionref a pointer to the function to be associated with the provided operator
* @param priority used to determine order of operations the higher the value the earlier it is evaluated
*/
static
int
addOperation
(
char
newoperator
,
shared_ptr
<
XdmfArray
>
(
*
functionref
)(
shared_ptr
<
XdmfArray
>
,
shared_ptr
<
XdmfArray
>
),
int
priority
);
/**
* Joins the two provided arrays together end to end.
*
* Example of Use:
*
* C++
*
* @dontinclude ExampleXdmfArray.cpp
* @skipline valueArray1
* @until (6)
* @skipline chunk
*
* Python
*
* @dontinclude XdmfExampleArray.py
* @skipline valueArray1
* @until (6)
* @skipline chunk
*
* @param val1 the first array being evaluated
* @param val2 the second array being evaluated
* @return the arrays joined end to end
*/
static
shared_ptr
<
XdmfArray
>
chunk
(
shared_ptr
<
XdmfArray
>
val1
,
shared_ptr
<
XdmfArray
>
val2
);
/**
* Joins the two provided arrays while interspercing their values evenly.
* Example of Use:
*
* C++
*
* @dontinclude ExampleXdmfArray.cpp
* @skipline valueArray1
* @until (6)
* @skipline interlace
*
* Python
*
* @dontinclude XdmfExampleArray.py
* @skipline valueArray1
* @until (6)
* @skipline interlace
*
* @param val1 the first array being evaluated
* @param val2 the second array being evaluated
* @return the interlaced arrays
*/
static
shared_ptr
<
XdmfArray
>
interlace
(
shared_ptr
<
XdmfArray
>
val1
,
shared_ptr
<
XdmfArray
>
val2
);
/**
* Evaluates the function specified using the vector of XdmfArrays provided.
* None of the XdmfArrays provided are modified during the evaluation process.
...
...
@@ -374,99 +405,6 @@ public:
*/
static
shared_ptr
<
XdmfArray
>
evaluateFunction
(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
valueVector
,
std
::
string
functionName
);
/*
* adds a specified function to the list of functions used while evaluating strings
*
* C++
*
* @dontinclude ExampleXdmfArray.cpp
* @skipline maximum
* @skipline main
* @skipline addFunction
* @skipline return
* @until }
* @skipline maximum
* @until else
* @skipline {
* @until returnArray;
* @skipline }
* @until }
*
* Python
*
* @dontinclude XdmfExampleArray.py
* @skipline maximum
* @until else
* @skipline maxVal
* @until pushBackAsFloat
* @skipline return
* @skipline __main__
* @skipline addFunction
*
* @param name A string to be associated with the provided function during string evaluation
* @param functionref A pointer to the function to be associated with the given string
* @return The total number of functions currently associated
*/
static
int
addFunction
(
std
::
string
name
,
shared_ptr
<
XdmfArray
>
(
*
functionref
)(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
));
/**
* Adds together all the values contained in the provided arrays.
*
* C++
*
* @dontinclude ExampleXdmfArray.cpp
* @skipline valueArray1
* @until valueVector
* @skipline valueArray1
* @until valueArray2
* @skipline sum
*
* Python
*
* @dontinclude XdmfExampleArray.py
* @skipline valueArray1
* @until valueVector
* @skipline valueArray1
* @until valueArray2
* @skipline sum
*
* @param values a vector containing the arrays to be used
* @return an XdmfArray containing one value which is the total of all the values contained within the provided arrays
*/
static
shared_ptr
<
XdmfArray
>
sum
(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
values
);
/**
* Averages the values contained in all the provided arrays.
*
* C++
*
* @dontinclude ExampleXdmfArray.cpp
* @skipline valueArray1
* @until valueVector
* @skipline valueArray1
* @until valueArray2
* @skipline ave
*
* Python
*
* @dontinclude XdmfExampleArray.py
* @skipline valueArray1
* @until valueVector
* @skipline valueArray1
* @until valueArray2
* @skipline ave
*
* @param values a vector containing the arrays to be used
* @return an XdmfArray containing one value which is the average of all values contained within the provided arrays
*/
static
shared_ptr
<
XdmfArray
>
ave
(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
values
);
/**
* Get the data type of this array.
*
...
...
@@ -579,10 +517,6 @@ public:
*/
std
::
string
getName
()
const
;
/**
* Gets the priority of operation whose associated character is provided. Returns -1 if the operation is not supported.
* The higher the value the earlier that operation is evaluated during evaluateExpression.
...
...
@@ -604,12 +538,6 @@ public:
*/
static
int
getOperationPriority
(
char
operation
);
/**
* Get the number of values stored in this array.
*
...
...
@@ -631,10 +559,6 @@ public:
*/
unsigned
int
getSize
()
const
;
/**
* Gets a string that contains all the characters of the supported operations.
* Parenthesis are included for grouping purposes in expressions.
...
...
@@ -677,47 +601,43 @@ public:
/**
* Gets a string that contains all strings that are viable for use when mapping
* to s
hared pointers of XdmfArrays
for the evaluateExpression function.
* to s
calars (which are stored in XdmfArrays of size 1)
for the evaluateExpression function.
*
* Example of Use:
*
* C++
*
* @dontinclude ExampleXdmfArray.cpp
* @skipline getValid
Variable
Chars
* @skipline getValid
Digit
Chars
*
* Python
*
* @dontinclude XdmfExampleArray.py
* @skipline getValid
Variable
Chars
* @skipline getValid
Digit
Chars
*
* @return
a string containing all valid variable characters
* @return
a string containing all valid variable characters
*/
static
const
std
::
string
getValid
Variable
Chars
();
static
const
std
::
string
getValid
Digit
Chars
();
/**
* Gets a string that contains all strings that are viable for use when mapping
* to s
calars (which are stored in XdmfArrays of size 1)
for the evaluateExpression function.
* to s
hared pointers of XdmfArrays
for the evaluateExpression function.
*
* Example of Use:
*
* C++
*
* @dontinclude ExampleXdmfArray.cpp
* @skipline getValid
Digit
Chars
* @skipline getValid
Variable
Chars
*
* Python
*
* @dontinclude XdmfExampleArray.py
* @skipline getValid
Digit
Chars
* @skipline getValid
Variable
Chars
*
* @return
a string containing all valid variable characters
* @return
a string containing all valid variable characters
*/
static
const
std
::
string
getValidDigitChars
();
static
const
std
::
string
getValidVariableChars
();
/**
* Get a copy of a single value stored in this array.
...
...
@@ -754,7 +674,7 @@ public:
*
* @dontinclude ExampleXdmfArray.cpp
* @skipline New
* @skipline
init
Array
* @skipline
store
Array
* @skipline exampleArray
* @until {0,2,4,6,8,5,3,7,4,9}
*
...
...
@@ -1095,6 +1015,30 @@ public:
const
unsigned
int
arrayStride
=
1
,
const
unsigned
int
valuesStride
=
1
);
/**
* Joins the two provided arrays while interspercing their values evenly.
* Example of Use:
*
* C++
*
* @dontinclude ExampleXdmfArray.cpp
* @skipline valueArray1
* @until (6)
* @skipline interlace
*
* Python
*
* @dontinclude XdmfExampleArray.py
* @skipline valueArray1
* @until (6)
* @skipline interlace
*
* @param val1 the first array being evaluated
* @param val2 the second array being evaluated
* @return the interlaced arrays
*/
static
shared_ptr
<
XdmfArray
>
interlace
(
shared_ptr
<
XdmfArray
>
val1
,
shared_ptr
<
XdmfArray
>
val2
);
/**
* Returns whether the array is initialized (contains values in
* memory).
...
...
@@ -1447,6 +1391,32 @@ public:
template
<
typename
T
>
void
setValuesInternal
(
const
shared_ptr
<
std
::
vector
<
T
>
>
array
);
/**
* Adds together all the values contained in the provided arrays.
*
* C++
*
* @dontinclude ExampleXdmfArray.cpp
* @skipline valueArray1
* @until valueVector
* @skipline valueArray1
* @until valueArray2
* @skipline sum
*
* Python
*
* @dontinclude XdmfExampleArray.py
* @skipline valueArray1
* @until valueVector
* @skipline valueArray1
* @until valueArray2
* @skipline sum
*
* @param values a vector containing the arrays to be used
* @return an XdmfArray containing one value which is the total of all the values contained within the provided arrays
*/
static
shared_ptr
<
XdmfArray
>
sum
(
std
::
vector
<
shared_ptr
<
XdmfArray
>
>
values
);
/**
* Exchange the contents of the vector with the contents of this
* array. No copy is made. The internal arrays are swapped.
...
...
@@ -1511,7 +1481,7 @@ public:
* @skipline initArray
* @skipline insert
* @skipline swapArray
* @until
exampleArray
* @until
swap(
* @skipline //
*