Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions src/axom/core/ArrayBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,15 +387,26 @@ class ArrayBase
updateStrides();
}

/// \brief Set the shape and stride
AXOM_HOST_DEVICE void setShapeAndStride(const StackArray<IndexType, DIM>& shape,
const StackArray<IndexType, DIM>& stride)
/*!
\brief Set the shape and stride

\param [in] shape
\param [in] stride
\param [in] orderPref Preference for resolving non-unique strides.
\a ROW means to advance left index first. \a COLUMN means to advance
right index first. Indexing is correct regardless of the
preference, but the index ordering is dependent on the choice.
*/
AXOM_HOST_DEVICE void setShapeAndStride(
const StackArray<IndexType, DIM>& shape,
const StackArray<IndexType, DIM>& stride,
axom::ArrayStrideOrder orderPref = axom::ArrayStrideOrder::ROW)
{
#ifdef AXOM_DEBUG
validateShapeAndStride(shape, stride);
#endif
m_shape = shape;
m_mapping.initializeStrides(stride);
m_mapping.initializeStrides(stride, orderPref);
m_minStride = m_mapping.fastestStrideLength();
}

Expand Down
11 changes: 7 additions & 4 deletions src/axom/core/MDMapping.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,13 @@ class MDMapping
os << strides[d] << ",";
}
os << strides[DIM - 1] << ")";
std::cerr << "ERROR: MDMapping: Non-unique strides " << os.str() << ".\n"
<< "Likely, multi-dim array shape is 1 in some direction.\n"
<< "Impossible to compute index ordering.\n"
<< "Please use a different MDMapping initializer.\n";
std::cerr
<< "ERROR: MDMapping: Non-unique strides " << os.str() << ".\n"
<< "Caused by multi-dim array shape of 1 in some direction.\n"
<< "It is impossible to compute index ordering.\n"
<< "Use initializeStrides() with the stride order preference to fix.\n"
<< "The resulting slowestDirs() depends on the preference\n"
<< "but the array mapping will still be correct.\n";
#endif
utilities::processAbort();
}
Expand Down
10 changes: 10 additions & 0 deletions src/axom/quest/DistributedClosestPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,5 +320,15 @@ void DistributedClosestPoint::verifyTopologyName(const conduit::Node& meshNode,
}
}

axom::IndexType DistributedClosestPoint::searchCount() const
{
return m_impl->searchCount();
}

double DistributedClosestPoint::effectiveDistanceThreshold() const
{
return m_impl->effectiveDistanceThreshold();
}

} // end namespace quest
} // end namespace axom
18 changes: 18 additions & 0 deletions src/axom/quest/DistributedClosestPoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "axom/config.hpp"
#include "axom/core/execution/runtime_policy.hpp"
#include "axom/core/Types.hpp"

#include "conduit_node.hpp"

Expand Down Expand Up @@ -173,6 +174,23 @@ class DistributedClosestPoint
void computeClosestPoints(conduit::Node& query_node,
const std::string& topology);

/*!
@brief Return the number of searches done on the last query
mesh's local partition.

This count includes 1 by the owner rank plus however many remote
ranks searched the partition.
*/
axom::IndexType searchCount() const;
/*!
@brief Return the effective distance threshold used for the
last query mesh's local partition.

Due to optimizations, this may be smaller than the value set
in setDistanceThreshold().
*/
double effectiveDistanceThreshold() const;

private:
/*!
@brief Allocate the DistributedClosestPointImpl object, which actually does the work.
Expand Down
15 changes: 10 additions & 5 deletions src/axom/quest/MeshViewUtil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ static void shapesToStridesAndOffsets(
@param offsets [i] Blueprint-style index offsets.
@param strides [i] Blueprint-style strides.
@param valuesCount [i] Number of values in
ghost-padded data.
ghost-padded data. If this is too small (results in
a negative \a hiPads for the slowest stride
direction), that padding will be bumped to zero.
@param paddedShape [o] \a realShape + \a loPads + \a hiPads
@param loPads [o] Ghost padding amount on low side.
@param hiPads [o] Ghost padding amount ont high side.
Expand Down Expand Up @@ -165,7 +167,9 @@ static void stridesAndOffsetsToShapes(const axom::StackArray<IType, DIM>& realSh
const int& nextDir = strideOrder[nd + 1];
paddedShape[curDir] = strides[nextDir] / strides[curDir];
}
paddedShape[strideOrder[DIM - 1]] = valuesCount / strides[strideOrder[DIM - 1]];
const int slowestDir = strideOrder[DIM - 1];
paddedShape[slowestDir] = std::max(valuesCount / strides[slowestDir],
realShape[slowestDir] + offsets[slowestDir]);

for(int d = 0; d < DIM; ++d)
{
Expand Down Expand Up @@ -500,7 +504,7 @@ class MeshViewUtil
/*!
@brief Return view to a scalar field variable.

WARNING: The view returned has an allocator id determined by
WARNING: The view returned claims an allocator id determined by
\a MemSpace, regardless of the memory type.

WARNING: Assuming, without checking, that the field contains
Expand Down Expand Up @@ -647,8 +651,9 @@ class MeshViewUtil

@param [in] fieldName
@param [in] association "vertex" or "element"
@param [in] dtype Conduit data type to put in the field. Must be at least
big enough for the strides and offsets specified.
@param [in] dtype Conduit data type to put in the field. If this is not
big enough for the strides and offsets specified, a minimally
sufficient size will be used to avoid negative ghost padding.
@param [in] strides Data strides. Set to zero for no ghosts and default strides.
@param [in] offsets Data index offsets. Set to zero for no ghosts.

Expand Down
Loading