Commit dc686f86 authored by Andrew J. Burns (Cont's avatar Andrew J. Burns (Cont

Finished converting documentation to tag-based version; adjusted line length where possible

parent a5f74bf5
......@@ -66,6 +66,17 @@
* shared pointers can be created. These pointers are freed
* automatically by the shared pointer reference counting mechanism.
*
*
* Structure:
*
* Xdmf2 is structured in a tree format with an XdmfDomain serving
* as the base. The Domain contains multiple grid collections or
* grids; each with their own geometries, topologies, attributes,
* and/or sets. With the inclusion of shared pointers in Xdmf2
* a topology could be shared across multiple grids or a grid
* could be included in multiple grid collections and/or the domain.
*
*
* C++ Examples:
*
* \subpage cppwrite "C++ Example of Xdmf Creation"
......
......@@ -182,7 +182,13 @@ public:
private:
XdmfTopologyTypeCurvilinear(const XdmfCurvilinearGrid * const curvilinearGrid) :
XdmfTopologyType(0, 0, std::vector<shared_ptr<const XdmfTopologyType> >(), 0, "foo", XdmfTopologyType::Structured, 0x1110),
XdmfTopologyType(0,
0,
std::vector<shared_ptr<const XdmfTopologyType> >(),
0,
"foo",
XdmfTopologyType::Structured,
0x1110),
mCurvilinearGrid(curvilinearGrid)
{
}
......
......@@ -37,7 +37,11 @@ const std::string XdmfFunction::mValidDigitChars = "-1234567890.";
// List the priorities for the operations, based on the order of operations
// The index of the corresponding operation in validOperationChars
// is the same as the index of its priority in this array
std::map<char, int> XdmfFunction::mOperationPriority = boost::assign::map_list_of ('|', 2) ('#', 1) ('(', 0) (')', 0);
std::map<char, int> XdmfFunction::mOperationPriority =
boost::assign::map_list_of ('|', 2)
('#', 1)
('(', 0)
(')', 0);
// The higher the value, the earlier the operation is
// evaluated in the order of operations
// With the exception of parenthesis which are evaluated
......@@ -127,8 +131,11 @@ XdmfFunction::chunk(shared_ptr<XdmfArray> val1, shared_ptr<XdmfArray> val2)
// Join chunk (add the new array to the end of the first one)
// Joins into new array and returns it
shared_ptr<XdmfArray> returnArray = XdmfArray::New();
// Determining what type to class it as in order to not lose data, and to still have the smallest data type of the two
shared_ptr<const XdmfArrayType> resultType = XdmfArrayType::comparePrecision(val1->getArrayType(), val2->getArrayType());
// Determining what type to class it as in order to not lose data
// and to still have the smallest data type of the two
shared_ptr<const XdmfArrayType> resultType =
XdmfArrayType::comparePrecision(val1->getArrayType(),
val2->getArrayType());
if (resultType == XdmfArrayType::Int8()) {
char sampleValue = 0;
......@@ -233,7 +240,8 @@ XdmfFunction::evaluateExpression(std::string expression,
}
}
else {
std::string currentFunction = expression.substr(valueStart, i + 1 - valueStart);
std::string currentFunction =
expression.substr(valueStart, i + 1 - valueStart);
// Check if next character is an open parenthesis
if (i+1 >= expression.size()) {
if (expression[i+1] != '(') {
......@@ -278,7 +286,9 @@ XdmfFunction::evaluateExpression(std::string expression,
parameterVector.push_back(evaluateExpression(functionParameters, variables));
}
else {
parameterVector.push_back(evaluateExpression(functionParameters.substr(0, parameterSplit), variables));
parameterVector.push_back(
evaluateExpression(functionParameters.substr(0, parameterSplit),
variables));
functionParameters = functionParameters.substr(parameterSplit+1);
}
}
......@@ -573,8 +583,10 @@ XdmfFunction::interlace(shared_ptr<XdmfArray> val1, shared_ptr<XdmfArray> val2)
// Builds a new array
shared_ptr<XdmfArray> returnArray = XdmfArray::New();
// Resize to the combined size of both arrays
// Determining what type to class it as in order to not lose data, and to still have the smallest data type of the two
shared_ptr<const XdmfArrayType> resultType = XdmfArrayType::comparePrecision(val1->getArrayType(), val2->getArrayType());
// Determining what type to class it as in order to not lose data
// and to still have the smallest data type of the two
shared_ptr<const XdmfArrayType> resultType =
XdmfArrayType::comparePrecision(val1->getArrayType(), val2->getArrayType());
if (resultType == XdmfArrayType::Int8()) {
char sampleValue = 0;
......@@ -635,7 +647,8 @@ XdmfFunction::interlace(shared_ptr<XdmfArray> val1, shared_ptr<XdmfArray> val2)
int arrayExcess1 = 0;
int arrayExcess2 = 0;
for (int i = 0; i < stride; ++i) {
// Add the values of each array, using strides to interlace and starting index to offset
// Add the values of each array
// using strides to interlace and starting index to offset
// first array gets the first value of the new array
if (i<arrayRatio1) {
int amountWritten = val1->getSize()/arrayRatio1;
......@@ -662,10 +675,20 @@ XdmfFunction::interlace(shared_ptr<XdmfArray> val1, shared_ptr<XdmfArray> val2)
}
}
if (arrayExcess1 > 0) {
returnArray->insert(val1->getSize()+val2->getSize()-arrayExcess1, val1, 0, arrayExcess1, 1, 1);
returnArray->insert(val1->getSize()+val2->getSize()-arrayExcess1,
val1,
0,
arrayExcess1,
1,
1);
}
else if (arrayExcess2 > 0) {
returnArray->insert(val1->getSize()+val2->getSize()-arrayExcess2, val2, 0, arrayExcess2, 1, 1);
returnArray->insert(val1->getSize()+val2->getSize()-arrayExcess2,
val2,
0,
arrayExcess2,
1,
1);
}
// After all inserts are done, add the excess values to the end of the array
return returnArray;
......
......@@ -29,9 +29,9 @@
#include "XdmfArray.hpp"
/**
* @brief
*
* @brief Manipulates arrays based on expressions.
*
* The function class provides a way to manipulate XdmfArrays via predefined functions.
*/
class XDMF_EXPORT XdmfFunction : public XdmfItem {
......@@ -84,7 +84,9 @@ public:
* @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);
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
......@@ -117,7 +119,8 @@ public:
* @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> >));
static int addFunction(std::string name,
shared_ptr<XdmfArray>(*functionref)(std::vector<shared_ptr<XdmfArray> >));
/**
* Averages the values contained in all the provided arrays.
......@@ -168,7 +171,8 @@ public:
* @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);
static shared_ptr<XdmfArray> chunk(shared_ptr<XdmfArray> val1,
shared_ptr<XdmfArray> val2);
/**
* Evaluates an expression based on the list of variables provided.
......@@ -223,7 +227,8 @@ public:
* @param variables a map of strings to their XdmfArray equivalent
* @return a shared pointer to the XdmfArray resulting from the expression
*/
static shared_ptr<XdmfArray> evaluateExpression(std::string expression, std::map<std::string, shared_ptr<XdmfArray> > variables);
static shared_ptr<XdmfArray> evaluateExpression(std::string expression,
std::map<std::string, shared_ptr<XdmfArray> > variables);
/**
* Evaluates the operation specified using the two shared pointers to XdmfArrays provided.
......@@ -269,7 +274,9 @@ public:
* @param operation a character specifying the operation performed
* @return a shared pointer to the Xdmf Array that results from the calculation
*/
static shared_ptr<XdmfArray> evaluateOperation(shared_ptr<XdmfArray> val1, shared_ptr<XdmfArray> val2, char operation);
static shared_ptr<XdmfArray> evaluateOperation(shared_ptr<XdmfArray> val1,
shared_ptr<XdmfArray> val2,
char operation);
/**
* Evaluates the function specified using the vector of XdmfArrays provided.
......@@ -311,7 +318,8 @@ public:
* @param functionName the string associated with the function being called
* @return the result of the function being called, a scalar will be returned as an XdmfArray with one value
*/
static shared_ptr<XdmfArray> evaluateFunction(std::vector<shared_ptr<XdmfArray> > valueVector, std::string functionName);
static shared_ptr<XdmfArray> evaluateFunction(std::vector<shared_ptr<XdmfArray> > valueVector,
std::string functionName);
std::map<std::string, std::string> getItemProperties() const;
......@@ -452,7 +460,8 @@ public:
* @param val2 the second array being evaluated
* @return the interlaced arrays
*/
static shared_ptr<XdmfArray> interlace(shared_ptr<XdmfArray> val1, shared_ptr<XdmfArray> val2);
static shared_ptr<XdmfArray> interlace(shared_ptr<XdmfArray> val1,
shared_ptr<XdmfArray> val2);
/**
* Adds together all the values contained in the provided arrays.
......
......@@ -221,7 +221,7 @@ public:
* @skipline #//setName
* @until #//setName
*
* @param name of the grid to set.
* @param name name of the grid to set.
*/
void setName(const std::string & name);
......
......@@ -245,7 +245,8 @@ XdmfItemFactory::createItem(const std::string & itemTag,
std::string expressionToParse;
if(expression == itemProperties.end()) {
try {
XdmfError::message(XdmfError::FATAL, "Error: Function found no expression");
XdmfError::message(XdmfError::FATAL,
"Error: Function found no expression");
}
catch (XdmfError e) {
throw e;
......@@ -257,13 +258,15 @@ XdmfItemFactory::createItem(const std::string & itemTag,
std::map<std::string, shared_ptr<XdmfArray> > variableCollection;
for (unsigned int i = 0; i < childItems.size(); ++i) {
try {
shared_ptr<XdmfArray> tempArray = shared_dynamic_cast<XdmfArray>(childItems[i]);
shared_ptr<XdmfArray> tempArray =
shared_dynamic_cast<XdmfArray>(childItems[i]);
variableCollection[tempArray->getName()] = tempArray;
tempArray->read();
}
catch (...) {
try {
XdmfError::message(XdmfError::FATAL, "Error: Function passed non-Array item");
XdmfError::message(XdmfError::FATAL,
"Error: Function passed non-Array item");
}
catch (XdmfError e) {
throw e;
......@@ -272,17 +275,20 @@ XdmfItemFactory::createItem(const std::string & itemTag,
}
shared_ptr<XdmfArray> parsedArray = shared_ptr<XdmfArray>();
try {
parsedArray = XdmfFunction::evaluateExpression(expressionToParse, variableCollection);
parsedArray = XdmfFunction::evaluateExpression(expressionToParse,
variableCollection);
}
catch (XdmfError e) {
throw e;
}
if (arraySubType != "DataItem") {
// The properties and children aren't really needed to generate the object, but the factory still requires them.
// The properties and children aren't really needed
// to generate the object, but the factory still requires them.
std::vector<shared_ptr<XdmfItem> > newArrayChildren;
shared_ptr<XdmfArray> returnArray = XdmfArray::New();
// This should generate an item that corresponds to the tag provided, the casting ensures that it is a subtype of array
// This should generate an item that corresponds to the tag provided
// the casting ensures that it is a subtype of array
// Using a factory to be able to build things outside of core
returnArray = shared_dynamic_cast<XdmfArray>(createItem(
arraySubType,
......
......@@ -194,7 +194,7 @@ public:
* @skipline #//getRemoteNodeIds
* @until #//getRemoteNodeIds
*
* @param remoteTaskId a task id to retrieve mapping for.
* @param remoteTaskId task id to retrieve mapping for.
*
* @return a map of local node ids to a vector of remote node ids on
* remoteTaskId.
......@@ -226,7 +226,8 @@ public:
* @skipline #//inserttuple
* @until #//inserttuple
*
* @param remoteTaskId task id where the remoteLoalNodeId is located.
* @param remoteTaskId task id where the remoteLoalNodeId is
* located.
* @param localNodeId the node id of the node being mapped.
* @param remoteLocalNodeId a node id on the remoteTaskId that the
* localNodeId is mapped to.
......@@ -328,12 +329,12 @@ public:
* @skipline #//setHeavyDataController
* @until #//setHeavyDataController
*
* @param remoteTaskIdsControllers a vector of XdmfHeavyDataControllers to the remote
* task ids dataset.
* @param localNodeIdsControllers a vector of XdmfHeavyDataControllers to the local
* node ids dataset.
* @param remoteLocalNodeIdsControllers a vector of XdmfHeavyDataControllers to the
* remote local node ids dataset.
* @param remoteTaskIdsControllers a vector of XdmfHeavyDataControllers
* to the remote task ids dataset.
* @param localNodeIdsControllers a vector of XdmfHeavyDataControllers
* to the local node ids dataset.
* @param remoteLocalNodeIdsControllers a vector of XdmfHeavyDataControllers
* to the remote local node ids dataset.
*/
void
setHeavyDataControllers(std::vector<shared_ptr<XdmfHeavyDataController> > remoteTaskIdsControllers,
......
......@@ -120,7 +120,9 @@ public:
}
else {
try {
XdmfError::message(XdmfError::FATAL, "Number of dimensions not 2 or 3 in XdmfGeometryTypeRectilinear::getProperties");
XdmfError::message(XdmfError::FATAL,
"Number of dimensions not 2 or 3 in"
" XdmfGeometryTypeRectilinear::getProperties");
}
catch (XdmfError e) {
throw e;
......@@ -276,7 +278,13 @@ public:
private:
XdmfTopologyTypeRectilinear(const XdmfRectilinearGrid * const rectilinearGrid) :
XdmfTopologyType(0, 0, std::vector<shared_ptr<const XdmfTopologyType> >(), 0, "foo", XdmfTopologyType::Structured, 0x1101),
XdmfTopologyType(0,
0,
std::vector<shared_ptr<const XdmfTopologyType> >(),
0,
"foo",
XdmfTopologyType::Structured,
0x1101),
mRectilinearGrid(rectilinearGrid)
{
}
......
......@@ -168,7 +168,8 @@ public:
* @until #//getCoodinatessingle
*
* @param axisIndex the index of the axis to retrieve, (i.e. 0 for
* x-axis). If no array exists at the index, return NULL.
* x-axis). If no array exists at the index,
* return NULL.
*
* @return array of coordinates along
*/
......@@ -193,7 +194,8 @@ public:
* Python: does not support a constant version of this function
*
* @param axisIndex the index of the axis to retrieve (i.e. 0 for
* x-axis). If no array exists at the index, return NULL.
* x-axis). If no array exists at the index,
* return NULL.
*
* @return array of coordinates along
*/
......@@ -329,9 +331,10 @@ public:
* @skipline #//setCoordinatessingle
* @until #//setCoordinatessingle
*
* @param axisIndex the index of the axis to set (i.e. 0 for x-axis).
* @param axisCoordinates the coordinates of points along a single axis to
* set.
* @param axisIndex the index of the axis to set
* (i.e. 0 for x-axis).
* @param axisCoordinates the coordinates of points along
* a single axis to set.
*/
void setCoordinates(const unsigned int axisIndex,
const shared_ptr<XdmfArray> axisCoordinates);
......@@ -361,7 +364,8 @@ public:
* @skipline #//setCoordinatesvector
* @until #//setCoordinatesvector
*
* @param axesCoordinates the coordinates of points along each axis.
* @param axesCoordinates the coordinates of points
* along each axis.
*/
void
setCoordinates(const std::vector<shared_ptr<XdmfArray> > axesCoordinates);
......
......@@ -336,8 +336,8 @@ public:
* @until #//setBrickSize
*
* @param brickSize the sizes of the points composing the mesh. This
* should have the same number of terms as the dimensionality of the
* mesh.
* should have the same number of terms as the
* dimensionality of the mesh.
*/
void setBrickSize(const shared_ptr<XdmfArray> brickSize);
......@@ -363,7 +363,7 @@ public:
* @skipline #//setDimensions
* @until #//setDimensions
*
* @param dimensions the dimension of the grid.
* @param dimensions The dimension of the grid.
*/
void setDimensions(const shared_ptr<XdmfArray> dimensions);
......@@ -389,7 +389,8 @@ public:
* @until #//setOrigin
*
* @param origin location of the origin of the grid. This should
* have the same number of terms as the dimensionality of the mesh.
* have the same number of terms as the dimensionality
* of the mesh.
*/
void setOrigin(const shared_ptr<XdmfArray> origin);
......
......@@ -735,7 +735,8 @@ XdmfArray::getHeavyDataController() const
void
XdmfArray::setHeavyDataController(shared_ptr<XdmfHeavyDataController> newController)
{
// Since this is replacing the previous version which was designed to completely replace the controller of the array
// Since this is replacing the previous version which was designed to
// completely replace the controller of the array
// It will clear the current controllers before adding the new one in
mHeavyDataControllers.clear();
mHeavyDataControllers.push_back(newController);
......@@ -940,7 +941,9 @@ XdmfArray::insert(const std::vector<unsigned int> startIndex,
&& numValues.size() == valuesStride.size())) {
try {
XdmfError::message(XdmfError::FATAL,
"Error: Number of starts, strides, and/or values retrieved does not match up with the dimensions of the array being retrieved from");
"Error: Number of starts, strides, and/or values "
"retrieved does not match up with the dimensions "
"of the array being retrieved from");
}
catch (XdmfError e) {
throw e;
......@@ -951,7 +954,9 @@ XdmfArray::insert(const std::vector<unsigned int> startIndex,
&& mDimensions.size() == arrayStride.size())) {
try {
XdmfError::message(XdmfError::FATAL,
"Error: Number of starts, strides, and/or values written does not match up with the dimensions of the array being inserted into");
"Error: Number of starts, strides, and/or values "
"written does not match up with the dimensions "
"of the array being inserted into");
}
catch (XdmfError e) {
throw e;
......@@ -1092,7 +1097,8 @@ 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
// In this case it is assumed that the controller will have
// dimensions equal to the array
for (unsigned int j = 0; j < mDimensions.size(); ++j) {
contentDims.push_back(mDimensions[j]);
}
......
......@@ -170,7 +170,7 @@ public:
* @skipline #//arraydefaultvalues
* @until #//arraydefaultvalues
* @skipline #//erase
* @until //#erase
* @until #//erase
*
* @param index the index of the value to be removed
*/
......@@ -382,7 +382,9 @@ public:
* @skipline //#getValues
* @until //#getValues
*
* Python: This function is not supported in Python, it is replaced by the getNumpyArray function
* Python:
* This function is not supported in Python,
* it is replaced by the getNumpyArray function
*
* @dontinclude XdmfExampleArray.py
* @skipline #//initialization
......@@ -395,10 +397,10 @@ public:
* @param startIndex the index in this array to begin copying from.
* @param valuesPointer a pointer to an array to copy into.
* @param numValues the number of values to copy.
* @param arrayStride number of values to stride in this array between each
* copy.
* @param valuesStride number of values to stride in the pointer between each
* copy.
* @param arrayStride number of values to stride in this array
* between each copy.
* @param valuesStride number of values to stride in the pointer
* between each copy.
*/
template <typename T> void
getValues(const unsigned int startIndex,
......@@ -421,7 +423,8 @@ public:
* @until //#getValuesInternalvector
*
* Python:
* Python does not support this version of the getValuesInternal function, it defaults to the version that returns a void pointer
* Python does not support this version of the getValuesInternal function,
* it defaults to the version that returns a void pointer
*
* @return a smart pointer to the internal vector of values stored
* in this array.
......@@ -467,7 +470,8 @@ public:
* @until //#getValuesInternalvoidconst
*
* Python:
* Python does not support this version of the getValuesInternal function, it defaults to the version that returns a void pointer
* Python does not support this version of the getValuesInternal function,
* it defaults to the version that returns a void pointer
*
* @return a void pointer to the first value stored in this array.
*/
......@@ -665,13 +669,14 @@ public:
* @until #//insertarray
*
* @param startIndex the index in this array to begin insertion.
* @param values a shared pointer to an XdmfArray to copy into this array.
* @param values a shared pointer to an XdmfArray to copy
* into this array.
* @param valuesStartIndex the index in the XdmfArray to begin copying.
* @param numValues the number of values to copy into this array.
* @param arrayStride number of values to stride in this array between each
* copy.
* @param valuesStride number of values to stride in the XdmfArray between
* each copy.
* @param arrayStride number of values to stride in this array
* between each copy.
* @param valuesStride number of values to stride in the XdmfArray
* between each copy.
*/
void insert(const unsigned int startIndex,
const shared_ptr<const XdmfArray> values,
......@@ -697,13 +702,24 @@ public:
* @skipline #//insertmultidim
* @until #//insertmultidim
*
* @param startIndex the index in this array to begin insertion for each dimension
* @param values a shared pointer to an XdmfArray to copy into this array.
* @param valuesStartIndex the index in the XdmfArray to begin copying for each dimension of the source array
* @param numValues the number of values to copy into this array for each dimension on the source array
* @param numInserted the number of strides to make across the array being written to for each dimension
* @param arrayStride number of values to stride in this array between each copy for each dimension
* @param valuesStride number of values to stride in the XdmfArray between each copy for each dimension of the source array
* @param startIndex the index in this array to begin
* insertion for each dimension
* @param values a shared pointer to an XdmfArray
* to copy into this array.
* @param valuesStartIndex the index in the XdmfArray to begin
* copying for each dimension of the
* source array
* @param numValues the number of values to copy into this
* array for each dimension on the
* source array
* @param numInserted the number of strides to make across
* the array being written to for each
* dimension
* @param arrayStride number of values to stride in this array
* between each copy for each dimension
* @param valuesStride number of values to stride in the
* XdmfArray between each copy for each
* dimension of the source array
*/
void insert(const std::vector<unsigned int> startIndex,
const shared_ptr<const XdmfArray> values,
......@@ -739,8 +755,8 @@ public:
* @param startIndex the index in this array to begin insertion.
* @param valuesPointer a pointer to the values to copy into this array.
* @param numValues the number of values to copy into this array.
* @param arrayStride number of values to stride in this array between each
* copy.
* @param arrayStride number of values to stride in this array between
* each copy.
* @param valuesStride number of values to stride in the pointer between
* each copy.
*/
......@@ -981,7 +997,8 @@ public:
* @until #//resizesingle
*
* @param numValues the number of values to resize this array to.
* @param value the number to initialize newly created values to, if needed.
* @param value the number to initialize newly created
* values to, if needed.
*/
template<typename T>
void resize(const unsigned int numValues,
......@@ -1017,7 +1034,8 @@ public:
* @until #//resizevector
*
* @param dimensions the dimensions to resize the array to.
* @param value the number to intialize newly created values to, if needed.
* @param value the number to intialize newly created values to,
* if needed.
*/
template<typename T>
void resize(const std::vector<unsigned int> & dimensions,
......@@ -1077,10 +1095,11 @@ public:
*
* Python: does not support setValuesInternal
*
* @param arrayPointer a pointer to an array to store in this XdmfArray.
* @param arrayPointer a pointer to an array to store in
* this XdmfArray.
* @param numValues the number of values in the array.
* @param transferOwnership whether to transfer responsibility for deletion