diff --git a/grid_gen/mesh_conversion_tools/Makefile b/grid_gen/mesh_conversion_tools/Makefile index 186601a0a..3028c1e48 100644 --- a/grid_gen/mesh_conversion_tools/Makefile +++ b/grid_gen/mesh_conversion_tools/Makefile @@ -1,31 +1,68 @@ #Assumes ${NETCDF} is defined to the root of the netcdf library -# gfortran +#### titan instructions #### +# module purge +# module load gcc/4.9.3 +# module load cray-netcdf/3.6.2 +# printenv NETCDF_DIR +# export NETCDF=$NETCDF_DIR +# make + +#### edison instructions #### +# In this file: +# comment gnu, uncomment intel flags +# change to: +# CC=CC +# may need to unload parallel NetCDF and HDF5 libraries +# to avoid g++ conflicts: +# module unload python +# then: +# module load cray-netcdf +# module load netcdf-cxx +# export NETCDF=/usr/common/graphics/netcdf-cxx/4.2 +# make + +# gnu CC=g++ -CFLAGS= -O3 -std=c++0x -fopenmp -DFLAGS= -g -std=c++0x -D_DEBUG -fopenmp +CFLAGS= -O3 -std=c++0x -fopenmp -lstdc++ +DFLAGS= -g -std=c++0x -D_DEBUG -fopenmp -lstdc++ # intel # CC=icpc -# CFLAGS= -O3 -std=c++0x -openmp -# DFLAGS= -g -std=c++0x -D_DEBUG -openmp +# CFLAGS= -O3 -std=c++0x -qopenmp -lstdc++ +# DFLAGS= -g -std=c++0x -D_DEBUG -qopenmp -lstdc++ CONV_EXECUTABLE= MpasMeshConverter.x CULL_EXECUTABLE= MpasCellCuller.x MASK_EXECUTABLE= MpasMaskCreator.x -NCINCDIR=${NETCDF}/include -NCLIBDIR=${NETCDF}/lib +ifneq (${NETCDF}, ) + ifneq ($(shell which ${NETCDF}/bin/nc-config 2> /dev/null), ) + LIBS = $(shell ${NETCDF}/bin/nc-config --libs) -lnetcdf_c++ + INCS = $(shell ${NETCDF}/bin/nc-config --cflags) + else + LIBS= -L${NETCDF}/lib + LIBS += -lnetcdf_c++ -lnetcdf + INCS = -I${NETCDF}/include + endif +else ifneq ($(shell which nc-config 2> /dev/null), ) + LIBS = $(shell nc-config --libs) -lnetcdf_c++ + INCS = $(shell nc-config --cflags) +else + LIBS= -L${NETCDF}/lib + LIBS += -lnetcdf_c++ -lnetcdf + INCS = -I${NETCDF}/include +endif all: - ${CC} mpas_mesh_converter.cpp netcdf_utils.cpp ${CFLAGS} -o ${CONV_EXECUTABLE} -I${NCINCDIR} -L${NCLIBDIR} -lnetcdf_c++ -lnetcdf -lstdc++ - ${CC} mpas_cell_culler.cpp netcdf_utils.cpp ${CFLAGS} -o ${CULL_EXECUTABLE} -I${NCINCDIR} -L${NCLIBDIR} -lnetcdf_c++ -lnetcdf -lstdc++ - ${CC} mpas_mask_creator.cpp netcdf_utils.cpp jsoncpp.cpp ${CFLAGS} -o ${MASK_EXECUTABLE} -I. -I${NCINCDIR} -L${NCLIBDIR} -lnetcdf_c++ -lnetcdf -lstdc++ + ${CC} mpas_mesh_converter.cpp netcdf_utils.cpp ${CFLAGS} -o ${CONV_EXECUTABLE} -I. ${INCS} ${LIBS} + ${CC} mpas_cell_culler.cpp netcdf_utils.cpp ${CFLAGS} -o ${CULL_EXECUTABLE} ${INCS} ${LIBS} + ${CC} mpas_mask_creator.cpp netcdf_utils.cpp jsoncpp.cpp ${CFLAGS} -o ${MASK_EXECUTABLE} -I. ${INCS} ${LIBS} debug: - ${CC} mpas_mesh_converter.cpp netcdf_utils.cpp ${DFLAGS} -o ${CONV_EXECUTABLE} -I${NCINCDIR} -L${NCLIBDIR} -lnetcdf_c++ -lnetcdf -lstdc++ - ${CC} mpas_cell_culler.cpp netcdf_utils.cpp ${DFLAGS} -o ${CULL_EXECUTABLE} -I${NCINCDIR} -L${NCLIBDIR} -lnetcdf_c++ -lnetcdf -lstdc++ - ${CC} mpas_mask_creator.cpp netcdf_utils.cpp jsoncpp.cpp ${DFLAGS} -o ${MASK_EXECUTABLE} -I. -I${NCINCDIR} -L${NCLIBDIR} -lnetcdf_c++ -lnetcdf -lstdc++ + ${CC} mpas_mesh_converter.cpp netcdf_utils.cpp ${DFLAGS} -o ${CONV_EXECUTABLE} ${INCS} ${LIBS} + ${CC} mpas_cell_culler.cpp netcdf_utils.cpp ${DFLAGS} -o ${CULL_EXECUTABLE} ${INCS} ${LIBS} + ${CC} mpas_mask_creator.cpp netcdf_utils.cpp jsoncpp.cpp ${DFLAGS} -o ${MASK_EXECUTABLE} -I. ${INCS} ${LIBS} clean: rm -f grid.nc diff --git a/grid_gen/mesh_conversion_tools/json/json.h b/grid_gen/mesh_conversion_tools/json/json.h index 42e7e7f4a..01225cac6 100644 --- a/grid_gen/mesh_conversion_tools/json/json.h +++ b/grid_gen/mesh_conversion_tools/json/json.h @@ -425,8 +425,8 @@ namespace Json { class JSON_API Exception : public std::exception { public: Exception(std::string const& msg); - ~Exception() throw() override; - char const* what() const throw() override; + ~Exception() throw() ; + char const* what() const throw() ; protected: std::string msg_; }; @@ -1581,9 +1581,9 @@ class JSON_API CharReaderBuilder : public CharReader::Factory { Json::Value settings_; CharReaderBuilder(); - ~CharReaderBuilder() override; + ~CharReaderBuilder() ; - CharReader* newCharReader() const override; + CharReader* newCharReader() const ; /** \return true if 'settings' are legal and consistent; * otherwise, indicate bad settings via 'invalid'. @@ -1778,12 +1778,12 @@ class JSON_API StreamWriterBuilder : public StreamWriter::Factory { Json::Value settings_; StreamWriterBuilder(); - ~StreamWriterBuilder() override; + ~StreamWriterBuilder() ; /** * \throw std::exception if something goes wrong (e.g. invalid settings) */ - StreamWriter* newStreamWriter() const override; + StreamWriter* newStreamWriter() const ; /** \return true if 'settings' are legal and consistent; * otherwise, indicate bad settings via 'invalid'. @@ -1824,7 +1824,7 @@ class JSON_API FastWriter : public Writer { public: FastWriter(); - ~FastWriter() override {} + ~FastWriter() {} void enableYAMLCompatibility(); @@ -1838,7 +1838,7 @@ class JSON_API FastWriter : public Writer { void omitEndingLineFeed(); public: // overridden from Writer - std::string write(const Value& root) override; + std::string write(const Value& root) ; private: void writeValue(const Value& value); @@ -1876,14 +1876,14 @@ class JSON_API FastWriter : public Writer { class JSON_API StyledWriter : public Writer { public: StyledWriter(); - ~StyledWriter() override {} + ~StyledWriter() {} public: // overridden from Writer /** \brief Serialize a Value in JSON format. * \param root Value to serialize. * \return String containing the JSON document that represents the root value. */ - std::string write(const Value& root) override; + std::string write(const Value& root) ; private: void writeValue(const Value& value); diff --git a/grid_gen/mesh_conversion_tools/jsoncpp.cpp b/grid_gen/mesh_conversion_tools/jsoncpp.cpp index ddb5137f5..985589c82 100644 --- a/grid_gen/mesh_conversion_tools/jsoncpp.cpp +++ b/grid_gen/mesh_conversion_tools/jsoncpp.cpp @@ -2088,7 +2088,7 @@ class OurCharReader : public CharReader { {} bool parse( char const* beginDoc, char const* endDoc, - Value* root, std::string* errs) override { + Value* root, std::string* errs) { bool ok = reader_.parse(beginDoc, endDoc, *root, collectComments_); if (errs) { *errs = reader_.getFormattedErrorMessages(); @@ -2652,7 +2652,7 @@ Value::CZString::CZString(const CZString& other) #if JSON_HAS_RVALUE_REFERENCES Value::CZString::CZString(CZString&& other) : cstr_(other.cstr_), index_(other.index_) { - other.cstr_ = nullptr; + other.cstr_ = NULL; } #endif @@ -4806,7 +4806,7 @@ struct BuiltStyledStreamWriter : public StreamWriter std::string const& endingLineFeedSymbol, bool useSpecialFloats, unsigned int precision); - int write(Value const& root, std::ostream* sout) override; + int write(Value const& root, std::ostream* sout) ; private: void writeValue(Value const& value); void writeArrayValue(Value const& value); diff --git a/grid_gen/mesh_conversion_tools/mpas_cell_culler.cpp b/grid_gen/mesh_conversion_tools/mpas_cell_culler.cpp index 291973ac6..b35568ee6 100644 --- a/grid_gen/mesh_conversion_tools/mpas_cell_culler.cpp +++ b/grid_gen/mesh_conversion_tools/mpas_cell_culler.cpp @@ -139,11 +139,11 @@ int main ( int argc, char *argv[] ) { for ( int i = 3; i < argc; i+=2 ) { if (strcmp(argv[i], "-m") == 0 ) { - mask_ops.push_back(merge); + mask_ops.push_back(static_cast(merge)); } else if ( strcmp(argv[i], "-i") == 0 ){ - mask_ops.push_back(invert); + mask_ops.push_back(static_cast(invert)); } else if ( strcmp(argv[i], "-p") == 0 ){ - mask_ops.push_back(preserve); + mask_ops.push_back(static_cast(preserve)); } else { cout << " ERROR: Invalid option passed on the command line " << argv[i] << ". Exiting..." << endl; exit(1); diff --git a/grid_gen/mesh_conversion_tools/mpas_mask_creator.cpp b/grid_gen/mesh_conversion_tools/mpas_mask_creator.cpp index 958ec729d..ae5633827 100644 --- a/grid_gen/mesh_conversion_tools/mpas_mask_creator.cpp +++ b/grid_gen/mesh_conversion_tools/mpas_mask_creator.cpp @@ -978,7 +978,7 @@ int resetFeatureInfo(){/*{{{*/ return 0; }/*}}}*/ int getFeatureInfo(const string featureFilename){/*{{{*/ - ifstream json_file(featureFilename); + ifstream json_file(featureFilename.c_str()); Json::Value root; string groupName, tempGroupName; vector pointIndices; @@ -1304,7 +1304,7 @@ int getFeatureInfo(const string featureFilename){/*{{{*/ return 0; }/*}}}*/ int getSeedInfo(const string seedFilename){/*{{{*/ - ifstream json_file(seedFilename); + ifstream json_file(seedFilename.c_str()); Json::Value root; json_file >> root;