Commit fdaccc22 authored by Kenneth Moreland's avatar Kenneth Moreland

Remove exports for header-only functions/methods

Change the VTKM_CONT_EXPORT to VTKM_CONT. (Likewise for EXEC and
EXEC_CONT.) Remove the inline from these macros so that they can be
applied to everything, including implementations in a library.

Because inline is not declared in these modifies, you have to add the
keyword to functions and methods where the implementation is not inlined
in the class.
parent 8861beda
......@@ -120,6 +120,6 @@ a tab stop is, so it is better to not use them at all.
+ Use vtkm::Scalar in lieu of float or double to represent data for computation and use vtkm::Id in lieu of int or long for data structure indices. This future-proofs code against changes in precision of the architecture. The indices of vtkm::Tuple are an exception. Using int to reference vtkm::Tuple (and other related classes like vtkm::exec::CellField and vtkm::math::Matrix) indices are acceptable as it is unreasonable to make these vectors longer than the precision of int.
+ All functions and methods defined within the VTK-M toolkit should be declared with VTKM_CONT_EXPORT, VTKM_EXEC_EXPORT, or VTKM_EXEC_CONT_EXPORT.
+ All functions and methods defined within the VTK-M toolkit should be declared with VTKM_CONT, VTKM_EXEC, or VTKM_EXEC_CONT.
We should note that although these conventions impose a strict statute on VTK-M coding, these rules (other than those involving licensing and copyright) are not meant to be dogmatic. Examples can be found in the existing code that break these conventions, particularly when the conventions stand in the way of readability (which is the point in having them in the first place). For example, it is often the case that it is more readable for a complicated typedef to stretch a few characters past 80 even if it pushes past the end of a display.
......@@ -36,7 +36,7 @@ struct ExampleFieldWorklet : public vtkm::worklet::WorkletMapField
typedef void ExecutionSignature( _1, _2, _3, _4, _5, _6 );
template<typename T, typename U, typename V>
VTKM_EXEC_EXPORT
VTKM_EXEC
void operator()( const vtkm::Vec< T, 3 > & vec,
const U & scalar1,
const V& scalar2,
......@@ -51,7 +51,7 @@ struct ExampleFieldWorklet : public vtkm::worklet::WorkletMapField
}
template<typename T, typename U, typename V, typename W, typename X, typename Y>
VTKM_EXEC_EXPORT
VTKM_EXEC
void operator()( const T &,
const U &,
const V&,
......
......@@ -141,7 +141,7 @@ struct HelloVTKMInterop
typedef void ControlSignature( FieldIn<>, FieldOut<>, FieldOut<> );
typedef void ExecutionSignature( _1, _2, _3 );
VTKM_EXEC_EXPORT
VTKM_EXEC
void operator()( const vtkm::Vec< T, 3 > & input,
vtkm::Vec<T, 3> & output,
vtkm::Vec<vtkm::UInt8, 4>& color ) const
......
......@@ -69,11 +69,11 @@ public:
const vtkm::Float32 xmin, ymin, zmin, xmax, ymax, zmax;
const vtkm::Id cellsPerLayer;
VTKM_CONT_EXPORT
VTKM_CONT
TangleField(const vtkm::Id3 dims, const vtkm::Float32 mins[3], const vtkm::Float32 maxs[3]) : xdim(dims[0]), ydim(dims[1]), zdim(dims[2]),
xmin(mins[0]), ymin(mins[1]), zmin(mins[2]), xmax(maxs[0]), ymax(maxs[1]), zmax(maxs[2]), cellsPerLayer((xdim) * (ydim)) { };
VTKM_EXEC_EXPORT
VTKM_EXEC
void operator()(const vtkm::Id &vertexId, vtkm::Float32 &v) const
{
const vtkm::Id x = vertexId % (xdim);
......
......@@ -43,7 +43,7 @@ struct GenerateSurfaceWorklet : public vtkm::worklet::WorkletMapField
typedef void ExecutionSignature( _1, _2, _3 );
template<typename T>
VTKM_EXEC_EXPORT
VTKM_EXEC
void operator()( const vtkm::Vec< T, 3 > & input,
vtkm::Vec<T, 3> & output,
vtkm::Vec<vtkm::UInt8, 4>& color ) const
......
......@@ -76,7 +76,7 @@ int mouse_state = 1;
struct GetVertexArray
{
template <typename ArrayHandleType>
VTKM_CONT_EXPORT
VTKM_CONT
void operator()(ArrayHandleType array) const
{
this->GetVertexPortal(array.GetPortalConstControl());
......@@ -84,7 +84,7 @@ struct GetVertexArray
private:
template <typename PortalType>
VTKM_CONT_EXPORT
VTKM_CONT
void GetVertexPortal(const PortalType &portal) const
{
for (vtkm::Id index = 0; index < portal.GetNumberOfValues(); index++)
......@@ -212,7 +212,7 @@ void mouseCall(int button, int state, int x, int y)
namespace {
template <typename T>
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
vtkm::Vec<T,3> Normalize(vtkm::Vec<T,3> v)
{
T magnitude = static_cast<T>(sqrt(vtkm::dot(v, v)));
......
......@@ -131,7 +131,7 @@ vtkm::cont::DataSet MakeTetrahedralizeExplicitDataSet()
struct GetVertexArray
{
template <typename ArrayHandleType>
VTKM_CONT_EXPORT
VTKM_CONT
void operator()(ArrayHandleType array) const
{
this->GetVertexPortal(array.GetPortalConstControl());
......@@ -139,7 +139,7 @@ struct GetVertexArray
private:
template <typename PortalType>
VTKM_CONT_EXPORT
VTKM_CONT
void GetVertexPortal(const PortalType &portal) const
{
for (vtkm::Id index = 0; index < portal.GetNumberOfValues(); index++)
......
......@@ -98,7 +98,7 @@ vtkm::cont::DataSet MakeTetrahedralizeTestDataSet(vtkm::Id3 dim)
struct GetVertexArray
{
template <typename ArrayHandleType>
VTKM_CONT_EXPORT
VTKM_CONT
void operator()(ArrayHandleType array) const
{
this->GetVertexPortal(array.GetPortalConstControl());
......@@ -106,7 +106,7 @@ struct GetVertexArray
private:
template <typename PortalType>
VTKM_CONT_EXPORT
VTKM_CONT
void GetVertexPortal(const PortalType &portal) const
{
for (vtkm::Id index = 0; index < portal.GetNumberOfValues(); index++)
......
......@@ -133,7 +133,7 @@ vtkm::cont::DataSet MakeTriangulateExplicitDataSet()
struct GetVertexArray
{
template <typename ArrayHandleType>
VTKM_CONT_EXPORT
VTKM_CONT
void operator()(ArrayHandleType array) const
{
this->GetVertexPortal(array.GetPortalConstControl());
......@@ -141,7 +141,7 @@ struct GetVertexArray
private:
template <typename PortalType>
VTKM_CONT_EXPORT
VTKM_CONT
void GetVertexPortal(const PortalType &portal) const
{
for (vtkm::Id index = 0; index < portal.GetNumberOfValues(); index++)
......
......@@ -91,7 +91,7 @@ vtkm::cont::DataSet MakeTriangulateTestDataSet(vtkm::Id2 dim)
struct GetVertexArray
{
template <typename ArrayHandleType>
VTKM_CONT_EXPORT
VTKM_CONT
void operator()(ArrayHandleType array) const
{
this->GetVertexPortal(array.GetPortalConstControl());
......@@ -99,7 +99,7 @@ struct GetVertexArray
private:
template <typename PortalType>
VTKM_CONT_EXPORT
VTKM_CONT
void GetVertexPortal(const PortalType &portal) const
{
for (vtkm::Id index = 0; index < portal.GetNumberOfValues(); index++)
......
......@@ -41,7 +41,7 @@ namespace vtkm {
struct Sum
{
template<typename T>
VTKM_EXEC_CONT_EXPORT T operator()(const T& x, const T& y) const
VTKM_EXEC_CONT T operator()(const T& x, const T& y) const
{
return x + y;
}
......@@ -53,7 +53,7 @@ struct Sum
struct Product
{
template<typename T>
VTKM_EXEC_CONT_EXPORT T operator()(const T& x, const T& y) const
VTKM_EXEC_CONT T operator()(const T& x, const T& y) const
{
return x * y;
}
......@@ -71,7 +71,7 @@ struct Product
struct Maximum
{
template<typename T>
VTKM_EXEC_CONT_EXPORT T operator()(const T& x, const T& y) const
VTKM_EXEC_CONT T operator()(const T& x, const T& y) const
{
return x < y ? y: x;
}
......@@ -84,7 +84,7 @@ struct Maximum
struct Minimum
{
template<typename T>
VTKM_EXEC_CONT_EXPORT T operator()(const T& x, const T& y) const
VTKM_EXEC_CONT T operator()(const T& x, const T& y) const
{
return x < y ? x: y;
}
......@@ -96,7 +96,7 @@ struct Minimum
struct BitwiseAnd
{
template<typename T>
VTKM_EXEC_CONT_EXPORT T operator()(const T& x, const T& y) const
VTKM_EXEC_CONT T operator()(const T& x, const T& y) const
{
return x & y;
}
......@@ -108,7 +108,7 @@ struct BitwiseAnd
struct BitwiseOr
{
template<typename T>
VTKM_EXEC_CONT_EXPORT T operator()(const T& x, const T& y) const
VTKM_EXEC_CONT T operator()(const T& x, const T& y) const
{
return x | y;
}
......@@ -120,7 +120,7 @@ struct BitwiseOr
struct BitwiseXor
{
template<typename T>
VTKM_EXEC_CONT_EXPORT T operator()(const T& x, const T& y) const
VTKM_EXEC_CONT T operator()(const T& x, const T& y) const
{
return x ^ y;
}
......
......@@ -30,7 +30,7 @@ namespace vtkm {
struct Equal
{
template<typename T>
VTKM_EXEC_CONT_EXPORT bool operator()(const T& x, const T& y) const
VTKM_EXEC_CONT bool operator()(const T& x, const T& y) const
{
return x == y;
}
......@@ -42,7 +42,7 @@ struct Equal
struct NotEqual
{
template<typename T>
VTKM_EXEC_CONT_EXPORT bool operator()(const T& x, const T& y) const
VTKM_EXEC_CONT bool operator()(const T& x, const T& y) const
{
return x != y;
}
......@@ -54,7 +54,7 @@ struct NotEqual
struct SortLess
{
template<typename T>
VTKM_EXEC_CONT_EXPORT bool operator()(const T& x, const T& y) const
VTKM_EXEC_CONT bool operator()(const T& x, const T& y) const
{
return x < y;
}
......@@ -67,7 +67,7 @@ struct SortLess
struct SortGreater
{
template<typename T>
VTKM_EXEC_CONT_EXPORT bool operator()(const T& x, const T& y) const
VTKM_EXEC_CONT bool operator()(const T& x, const T& y) const
{
return y < x;
}
......@@ -80,7 +80,7 @@ struct SortGreater
struct LogicalAnd
{
template<typename T>
VTKM_EXEC_CONT_EXPORT bool operator()(const T& x, const T& y) const
VTKM_EXEC_CONT bool operator()(const T& x, const T& y) const
{
return x && y;
}
......@@ -93,7 +93,7 @@ struct LogicalAnd
struct LogicalOr
{
template<typename T>
VTKM_EXEC_CONT_EXPORT bool operator()(const T& x, const T& y) const
VTKM_EXEC_CONT bool operator()(const T& x, const T& y) const
{
return x || y;
}
......
......@@ -41,10 +41,10 @@ struct Bounds
vtkm::Range Y;
vtkm::Range Z;
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
Bounds() { }
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
Bounds(const vtkm::Range &xRange,
const vtkm::Range &yRange,
const vtkm::Range &zRange)
......@@ -56,7 +56,7 @@ struct Bounds
typename T4,
typename T5,
typename T6>
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
Bounds(const T1 &minX, const T2 &maxX,
const T3 &minY, const T4 &maxY,
const T5 &minZ, const T6 &maxZ)
......@@ -69,7 +69,7 @@ struct Bounds
/// ymin, ymax, zmin, zmax.
///
template<typename T>
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
explicit Bounds(const T bounds[6])
: X(vtkm::Range(bounds[0], bounds[1])),
Y(vtkm::Range(bounds[2], bounds[3])),
......@@ -80,14 +80,14 @@ struct Bounds
/// point.
///
template<typename T>
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
Bounds(const vtkm::Vec<T,3> &minPoint, const vtkm::Vec<T,3> &maxPoint)
: X(vtkm::Range(minPoint[0], maxPoint[0])),
Y(vtkm::Range(minPoint[1], maxPoint[1])),
Z(vtkm::Range(minPoint[2], maxPoint[2]))
{ }
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
const vtkm::Bounds &operator=(const vtkm::Bounds &src)
{
this->X = src.X;
......@@ -102,7 +102,7 @@ struct Bounds
/// the bounds are any real region, even if a single point or it expands to
/// infinity, true is returned.
///
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
bool IsNonEmpty() const
{
return (this->X.IsNonEmpty() &&
......@@ -113,7 +113,7 @@ struct Bounds
/// \b Determines if a point coordinate is within the bounds.
///
template<typename T>
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
bool Contains(const vtkm::Vec<T,3> &point) const
{
return (this->X.Contains(point[0]) &&
......@@ -126,7 +126,7 @@ struct Bounds
/// \c Center computes the point at the middle of the bounds. If the bounds
/// are empty, the results are undefined.
///
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
vtkm::Vec<vtkm::Float64,3> Center() const
{
return vtkm::Vec<vtkm::Float64,3>(this->X.Center(),
......@@ -141,7 +141,7 @@ struct Bounds
/// nothing is done.
///
template<typename T>
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
void Include(const vtkm::Vec<T,3> &point)
{
this->X.Include(point[0]);
......@@ -154,7 +154,7 @@ struct Bounds
/// This version of \c Include expands these bounds just enough to include
/// that of another bounds. Esentially it is the union of the two bounds.
///
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
void Include(const vtkm::Bounds &bounds)
{
this->X.Include(bounds.X);
......@@ -166,7 +166,7 @@ struct Bounds
///
/// This is a nondestructive form of \c Include.
///
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
vtkm::Bounds Union(const vtkm::Bounds &otherBounds) const
{
vtkm::Bounds unionBounds(*this);
......@@ -176,13 +176,13 @@ struct Bounds
/// \b Operator for union
///
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
vtkm::Bounds operator+(const vtkm::Bounds &otherBounds) const
{
return this->Union(otherBounds);
}
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
bool operator==(const vtkm::Bounds &bounds) const
{
return ((this->X == bounds.X) &&
......@@ -190,7 +190,7 @@ struct Bounds
(this->Z == bounds.Z));
}
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
bool operator!=(const vtkm::Bounds &bounds) const
{
return ((this->X != bounds.X) ||
......@@ -203,7 +203,7 @@ struct Bounds
/// Helper function for printing bounds during testing
///
VTKM_CONT_EXPORT
static inline VTKM_CONT
std::ostream &operator<<(std::ostream &stream, const vtkm::Bounds &bounds)
{
return stream << "{ X:" << bounds.X
......
......@@ -98,7 +98,7 @@ struct CellShapeIdToTag {
template<> \
struct CellShapeTagCheck<vtkm::CellShapeTag ## name> : std::true_type { }; \
} \
VTKM_EXEC_CONT_EXPORT \
static inline VTKM_EXEC_CONT \
const char *GetCellShapeName(vtkm::CellShapeTag ## name) { \
return #name; \
} \
......@@ -134,7 +134,7 @@ VTKM_DEFINE_CELL_TAG(Pyramid, CELL_SHAPE_PYRAMID);
/// \c vtkmGenericCellShapeMacro to specialize on the cell type.
///
struct CellShapeTagGeneric {
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
CellShapeTagGeneric(vtkm::IdComponent shape) : Id(shape) { }
vtkm::IdComponent Id;
......@@ -163,7 +163,7 @@ struct CellShapeTagGeneric {
///
/// \code{.cpp}
/// template<typename WorkletType>
/// VTKM_EXEC_EXPORT
/// VTKM_EXEC
/// void MyCellOperation(vtkm::CellShapeTagGeneric cellShape,
/// const vtkm::exec::FunctorBase &worklet)
/// {
......
......@@ -29,37 +29,37 @@ namespace vtkm {
class Plane
{
public:
VTKM_CONT_EXPORT
VTKM_CONT
Plane()
: Origin(FloatDefault(0)),
Normal(FloatDefault(0), FloatDefault(0), FloatDefault(1))
{ }
VTKM_CONT_EXPORT
VTKM_CONT
explicit Plane(const vtkm::Vec<FloatDefault, 3> &normal)
: Origin(FloatDefault(0)),
Normal(normal)
{ }
VTKM_CONT_EXPORT
VTKM_CONT
Plane(const vtkm::Vec<FloatDefault, 3> &origin,
const vtkm::Vec<FloatDefault, 3> &normal)
: Origin(origin), Normal(normal)
{ }
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
const vtkm::Vec<FloatDefault, 3>& GetOrigin() const
{
return this->Origin;
}
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
const vtkm::Vec<FloatDefault, 3>& GetNormal() const
{
return this->Normal;
}
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
FloatDefault Value(FloatDefault x, FloatDefault y, FloatDefault z) const
{
return ((x - this->Origin[0]) * this->Normal[0]) +
......@@ -67,19 +67,19 @@ public:
((z - this->Origin[2]) * this->Normal[2]);
}
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
FloatDefault Value(const vtkm::Vec<FloatDefault, 3> &x) const
{
return this->Value(x[0], x[1], x[2]);
}
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
vtkm::Vec<FloatDefault, 3> Gradient(FloatDefault, FloatDefault, FloatDefault) const
{
return this->Normal;
}
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
vtkm::Vec<FloatDefault, 3> Gradient(const vtkm::Vec<FloatDefault, 3>&) const
{
return this->Normal;
......@@ -95,32 +95,32 @@ private:
class Sphere
{
public:
VTKM_CONT_EXPORT
VTKM_CONT
Sphere() : Radius(FloatDefault(0.2)), Center(FloatDefault(0))
{ }
VTKM_CONT_EXPORT
VTKM_CONT
explicit Sphere(FloatDefault radius) : Radius(radius), Center(FloatDefault(0))
{ }
VTKM_CONT_EXPORT
VTKM_CONT
Sphere(vtkm::Vec<FloatDefault, 3> center, FloatDefault radius)
: Radius(radius), Center(center)
{ }
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
FloatDefault GetRadius() const
{
return this->Radius;
}
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
const vtkm::Vec<FloatDefault, 3>& GetCenter() const
{
return this->Center;
}
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
FloatDefault Value(FloatDefault x, FloatDefault y, FloatDefault z) const
{
return ((x - this->Center[0]) * (x - this->Center[0]) +
......@@ -129,20 +129,20 @@ public:
(this->Radius * this->Radius);
}
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
FloatDefault Value(const vtkm::Vec<FloatDefault, 3> &x) const
{
return this->Value(x[0], x[1], x[2]);
}
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
vtkm::Vec<FloatDefault, 3> Gradient(FloatDefault x, FloatDefault y, FloatDefault z)
const
{
return this->Gradient(vtkm::Vec<FloatDefault, 3>(x, y, z));
}
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
vtkm::Vec<FloatDefault, 3> Gradient(const vtkm::Vec<FloatDefault, 3> &x) const
{
return FloatDefault(2) * (x - this->Center);
......@@ -158,23 +158,23 @@ template <typename ImplicitFunction>
class ImplicitFunctionValue
{
public:
VTKM_CONT_EXPORT
VTKM_CONT
ImplicitFunctionValue()
: Function()
{ }
VTKM_CONT_EXPORT
VTKM_CONT
explicit ImplicitFunctionValue(const ImplicitFunction &func)
: Function(func)
{ }
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
FloatDefault operator()(const vtkm::Vec<FloatDefault, 3> x) const
{
return this->Function.Value(x);
}
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
FloatDefault operator()(FloatDefault x, FloatDefault y, FloatDefault z) const
{
return this->Function.Value(x, y, z);
......@@ -190,23 +190,23 @@ template <typename ImplicitFunction>
class ImplicitFunctionGradient
{
public:
VTKM_CONT_EXPORT
VTKM_CONT
ImplicitFunctionGradient()
: Function()
{ }
VTKM_CONT_EXPORT
VTKM_CONT
explicit ImplicitFunctionGradient(const ImplicitFunction &func)
: Function(func)
{ }
VTKM_EXEC_CONT_EXPORT
VTKM_EXEC_CONT
FloatDefault operator()(const