Skip to content

Commit

Permalink
Merge pull request #31 from LLNL/clang-build
Browse files Browse the repository at this point in the history
Clang Build Fixing Errors and Warnings
  • Loading branch information
mdavis36 authored Oct 8, 2020
2 parents 4792913 + 305cd7a commit db9d87d
Show file tree
Hide file tree
Showing 47 changed files with 133 additions and 301 deletions.
2 changes: 1 addition & 1 deletion cmake/SetupSpheral.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include(ExternalProject)
# Configure CMake
#-------------------------------------------------------------------------------
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-undefined-var-template")
set(CMAKE_EXPORT_COMPILE_COMMANDS On)

if (NOT CMAKE_MODULE_PATH)
Expand Down
6 changes: 5 additions & 1 deletion cmake/spheral/SpheralAddLibs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ function(spheral_add_pybind11_library package_name)
SHARED TRUE
)
add_dependencies(${MODULE_NAME} ${spheral_py_depends} ${spheral_depends})
target_compile_options(${MODULE_NAME} PRIVATE "-Wno-unused-local-typedefs")
target_compile_options(${MODULE_NAME} PRIVATE
"-Wno-unused-local-typedefs"
"-Wno-self-assign-overloaded"
"-Wno-overloaded-virtual"
"-Wno-delete-non-abstract-non-virtual-dtor")

install(TARGETS ${MODULE_NAME}
DESTINATION Spheral
Expand Down
2 changes: 1 addition & 1 deletion cmake/tpl/boost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
set(TOOLSET "intel-linux")
else()
set(TOOLSET ${CMAKE_CXX_COMPILER_ID})
string(TOLOWER ${CMAKE_CXX_COMPILER_ID} TOOLSET)
endif()

set(BOOST_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/${lib_name})
Expand Down
7 changes: 4 additions & 3 deletions src/Boundary/ReflectingBoundary.hh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "Boundary/Boundary.hh"
#include "Boundary/PlanarBoundary.hh"
#include "RK/RKCorrectionParams.hh"
#include "boost/unordered_map.hpp"

#include "Eigen/Sparse"

Expand Down Expand Up @@ -46,7 +47,7 @@ public:
virtual void applyGhostBoundary(Field<Dimension, FourthRankTensor>& field) const override;
virtual void applyGhostBoundary(Field<Dimension, FifthRankTensor>& field) const override;
virtual void applyGhostBoundary(Field<Dimension, FacetedVolume>& field) const override;
virtual void applyGhostBoundary(Field<Dimension, RKCoefficients<Dimension>>& field) const;
virtual void applyGhostBoundary(Field<Dimension, RKCoefficients<Dimension>>& field) const override;
virtual void applyGhostBoundary(Field<Dimension, std::vector<Vector>>& field) const override;

// Apply the boundary condition to the violation node values in the given Field.
Expand All @@ -57,7 +58,7 @@ public:
virtual void enforceBoundary(Field<Dimension, FourthRankTensor>& field) const override;
virtual void enforceBoundary(Field<Dimension, FifthRankTensor>& field) const override;
virtual void enforceBoundary(Field<Dimension, FacetedVolume>& field) const override;
virtual void enforceBoundary(Field<Dimension, RKCoefficients<Dimension>>& field) const;
virtual void enforceBoundary(Field<Dimension, RKCoefficients<Dimension>>& field) const override;
virtual void enforceBoundary(Field<Dimension, std::vector<Vector>>& field) const override;

// Apply the boundary condition to face centered fields on a tessellation.
Expand Down Expand Up @@ -98,7 +99,7 @@ public:
private:
//--------------------------- Private Interface ---------------------------//
Tensor mReflectOperator;
std::unordered_map<RKOrder, std::pair<TransformationMatrix, TransformationMatrix>> mrkReflectOperators;
boost::unordered_map<RKOrder, std::pair<TransformationMatrix, TransformationMatrix>> mrkReflectOperators;
};

}
Expand Down
5 changes: 0 additions & 5 deletions src/Damage/DamageModel.hh
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ public:
State<Dimension>& state,
StateDerivatives<Dimension>& derivatives) override;

virtual
TimeStepType dt(const DataBase<Dimension>& dataBase,
const State<Dimension>& state,
const StateDerivatives<Dimension>& derivs,
const Scalar currentTime) const = 0;
//...........................................................................

// Optional method to cull the set of flaws to the single weakest one on
Expand Down
2 changes: 1 addition & 1 deletion src/Distributed/RedistributeNodes.hh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ template<typename Dimension> class DataBase;
template<typename Dimension> class NodeList;
template<typename Dimension> class Boundary;
template<typename Dimension, typename DataType> class FieldList;
template<typename Dimension> class DomainNode;
template<typename Dimension> struct DomainNode;

template<typename Dimension>
class RedistributeNodes {
Expand Down
28 changes: 14 additions & 14 deletions src/Field/Field.hh
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,19 @@ public:
const std::vector<DataType,DataAllocator<DataType>>& array);
Field(const NodeList<Dimension>& nodeList, const Field& field);
Field(const Field& field);
virtual std::shared_ptr<FieldBase<Dimension> > clone() const;
virtual std::shared_ptr<FieldBase<Dimension> > clone() const override;

// Destructor.
virtual ~Field();

// Assignment operator.
virtual FieldBase<Dimension>& operator=(const FieldBase<Dimension>& rhs);
virtual FieldBase<Dimension>& operator=(const FieldBase<Dimension>& rhs) override;
Field& operator=(const Field& rhs);
Field& operator=(const std::vector<DataType,DataAllocator<DataType>>& rhs);
Field& operator=(const DataType& rhs);

// Required method to test equivalence with a FieldBase.
virtual bool operator==(const FieldBase<Dimension>& rhs) const;
virtual bool operator==(const FieldBase<Dimension>& rhs) const override;

// Element access.
DataType& operator()(int index);
Expand All @@ -95,10 +95,10 @@ public:
unsigned numElements() const;
unsigned numInternalElements() const;
unsigned numGhostElements() const;
virtual unsigned size() const;
virtual unsigned size() const override;

// Zero out the field elements.
virtual void Zero();
virtual void Zero() override;

// Methods to apply limits to Field data members.
void applyMin(const DataType& dataMin);
Expand Down Expand Up @@ -206,17 +206,17 @@ public:
const DataType& operator[](const unsigned int index) const;

// Required functions from FieldBase
virtual void setNodeList(const NodeList<Dimension>& nodeList);
virtual void resizeField(unsigned size);
virtual void resizeFieldInternal(unsigned size, unsigned oldFirstGhostNode);
virtual void resizeFieldGhost(unsigned size);
virtual void deleteElement(int nodeID);
virtual void deleteElements(const std::vector<int>& nodeIDs);
virtual std::vector<char> packValues(const std::vector<int>& nodeIDs) const;
virtual void setNodeList(const NodeList<Dimension>& nodeList) override;
virtual void resizeField(unsigned size) override;
virtual void resizeFieldInternal(unsigned size, unsigned oldFirstGhostNode) override;
virtual void resizeFieldGhost(unsigned size) override;
virtual void deleteElement(int nodeID) override;
virtual void deleteElements(const std::vector<int>& nodeIDs) override;
virtual std::vector<char> packValues(const std::vector<int>& nodeIDs) const override;
virtual void unpackValues(const std::vector<int>& nodeIDs,
const std::vector<char>& buffer);
const std::vector<char>& buffer) override;
virtual void copyElements(const std::vector<int>& fromIndices,
const std::vector<int>& toIndices);
const std::vector<int>& toIndices) override;
virtual bool fixedSizeDataType() const override;
virtual int numValsInDataType() const override;
virtual int sizeofDataType() const override;
Expand Down
5 changes: 3 additions & 2 deletions src/Field/FieldListSet.hh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
namespace Spheral {

template<typename Dimension>
struct FieldListSet {
class FieldListSet {
public:
std::vector< FieldList<Dimension, typename Dimension::Scalar> > ScalarFieldLists;
std::vector< FieldList<Dimension, typename Dimension::Vector> > VectorFieldLists;
std::vector< FieldList<Dimension, typename Dimension::Tensor> > TensorFieldLists;
Expand All @@ -34,7 +35,7 @@ struct FieldListSet {
#else

namespace Spheral {
template<typename Dimension> struct FieldListSet;
template<typename Dimension> class FieldListSet;
}

#endif
6 changes: 3 additions & 3 deletions src/FieldOperations/sampleMultipleFields2Lattice.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ stepSize(const typename Dimension::Vector& xmin,
template<typename Dimension>
inline
vector<int>
makeIndex(const int ix,
const int iy,
const int iz) {
makeIndex(const int /*ix*/,
const int /*iy*/,
const int /*iz*/) {
REQUIRE(false);
return vector<int>();
}
Expand Down
6 changes: 3 additions & 3 deletions src/FieldOperations/sampleMultipleFields2LatticeMash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ stepSize(const typename Dimension::Vector& xmin,
template<typename Dimension>
inline
vector<int>
makeIndex(const int ix,
const int iy,
const int iz) {
makeIndex(const int /*ix*/,
const int /*iy*/,
const int /*iz*/) {
REQUIRE(false);
return vector<int>();
}
Expand Down
4 changes: 0 additions & 4 deletions src/Geometry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,11 @@ set(Geometry_sources
Geom3Vector.cc
GeomFacet2d.cc
GeomFacet3d.cc
GeomFifthRankTensor.cc
GeomFourthRankTensor.cc
GeomPlane.cc
GeomPolygon.cc
GeomPolyhedron.cc
GeomSymmetricTensor.cc
GeomTensor.cc
GeomThirdRankTensor.cc
GeomVector.cc
Jacobi.cc
Jacobi2.cc
buildEigenVector.cc
Expand Down
2 changes: 1 addition & 1 deletion src/Geometry/GeomFacet1d.hh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public:
const Vector& normal() const;

// For consistency with GeomFacet3d.
void decompose(std::vector<std::array<Vector, 1>>& subfacets) const;
void decompose(std::vector<std::array<Vector, 1>>& subfacets);

private:
//--------------------------- Private Interface ---------------------------//
Expand Down
4 changes: 3 additions & 1 deletion src/Geometry/GeomFacet1dInline.hh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "GeomVector.hh"
#include "Utilities/SpheralFunctions.hh"
#include <array>

namespace Spheral {

Expand Down Expand Up @@ -70,7 +71,8 @@ normal() const {
inline
void
GeomFacet1d::
decompose(std::vector<std::array<Vector, 1>>& subfacets) const {
decompose(std::vector<std::array<Vector, 1>>& subfacets) {
//subfacets[0] = std::array<Vector,1>{Vector(mPoint)};
subfacets = {{mPoint}};
}

Expand Down
25 changes: 0 additions & 25 deletions src/Geometry/GeomFifthRankTensor.cc

This file was deleted.

3 changes: 3 additions & 0 deletions src/Geometry/GeomFifthRankTensor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ private:
using RankNTensor<nDim, 5, GeomFifthRankTensor>::mElements;
};

template<int nDims> const typename GeomFifthRankTensor<nDims>::size_type GeomFifthRankTensor<nDims>::numElements = calcNumNRankElements<nDims, 5>();
template<int nDims> const GeomFifthRankTensor<nDims> GeomFifthRankTensor<nDims>::zero = GeomFifthRankTensor<nDims>(0.0);

}

#include "GeomFifthRankTensorInline.hh"
Expand Down
25 changes: 0 additions & 25 deletions src/Geometry/GeomFourthRankTensor.cc

This file was deleted.

3 changes: 3 additions & 0 deletions src/Geometry/GeomFourthRankTensor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ private:
using RankNTensor<nDim, 4, GeomFourthRankTensor>::mElements;
};

template<int nDims> const typename GeomFourthRankTensor<nDims>::size_type GeomFourthRankTensor<nDims>::numElements = calcNumNRankElements<nDims, 4>();
template<int nDims> const GeomFourthRankTensor<nDims> GeomFourthRankTensor<nDims>::zero = GeomFourthRankTensor<nDims>(0.0);

}

#include "GeomFourthRankTensorInline.hh"
Expand Down
13 changes: 1 addition & 12 deletions src/Geometry/GeomPolygon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "Utilities/lineSegmentIntersections.hh"
#include "Utilities/CounterClockwiseComparator.hh"
#include "Utilities/pointInPolygon.hh"
#include "Utilities/KeyTraits.hh"

#include <algorithm>
#include <numeric>
Expand Down Expand Up @@ -47,18 +48,6 @@ namespace Spheral {
// implemented in polytope.
namespace {

struct KeyTraits {
// typedef uint64_t Key;
typedef int64_t Key;
static const uint32_t numbits;
static const uint32_t numbits1d;
static const Key zero;
static const Key one;
static const Key two;
static const Key maxKey1d;
static const Key maxKey;
};

namespace geometry {

//------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/Geometry/GeomPolyhedron.cc
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ intersect(const Vector& s0, const Vector& s1) const {

// First does the line segment intersect the facet plane?
const auto shat_dot_fhat = shat.dot(fhat);
if (abs(shat_dot_fhat) > 1.0e-10) { // Check for segment parallel to plane
if (fabs(shat_dot_fhat) > 1.0e-10) { // Check for segment parallel to plane
const auto q = (mVertices[ipoints[0]] - s0).dot(fhat)/shat_dot_fhat;
if (q >= 0.0 and q <= q01) { // Does the line segment intersect the plane
return true;
Expand Down Expand Up @@ -576,7 +576,7 @@ intersections(const Vector& s0, const Vector& s1,

// First does the line segment intersect the facet plane?
const auto shat_dot_fhat = shat.dot(fhat);
if (abs(shat_dot_fhat) > 1.0e-10) { // Check for segment parallel to plane
if (fabs(shat_dot_fhat) > 1.0e-10) { // Check for segment parallel to plane
const auto q = (mVertices[ipoints[0]] - s0).dot(fhat)/shat_dot_fhat;
if (q >= 0.0 and q <= q01) { // Does the line segment intersect the plane
const auto p = s0 + q*shat; // point along line in plane
Expand Down
25 changes: 0 additions & 25 deletions src/Geometry/GeomThirdRankTensor.cc

This file was deleted.

4 changes: 4 additions & 0 deletions src/Geometry/GeomThirdRankTensor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ private:
using RankNTensor<nDim, 3, GeomThirdRankTensor>::mElements;
};


template<int nDims> const typename GeomThirdRankTensor<nDims>::size_type GeomThirdRankTensor<nDims>::numElements = calcNumNRankElements<nDims, 3>();
template<int nDims> const GeomThirdRankTensor<nDims> GeomThirdRankTensor<nDims>::zero = GeomThirdRankTensor<nDims>(0.0);

}

#include "GeomThirdRankTensorInline.hh"
Expand Down
Loading

0 comments on commit db9d87d

Please sign in to comment.