diff --git a/modules/base/src/test_utils/compare_files.cc b/modules/base/src/test_utils/compare_files.cc index 904b14a7fa75dde9bf4edcf3cab176966f312dc1..83a52f66f743a8d0252bc93a389c238dcb928ff7 100644 --- a/modules/base/src/test_utils/compare_files.cc +++ b/modules/base/src/test_utils/compare_files.cc @@ -37,8 +37,8 @@ bool compare_files(const String& test, const String& gold_standard) } String test_line, gold_line; while (true) { - bool test_end=std::getline(test_stream, test_line) != 0; - bool gold_end=std::getline(gold_stream, gold_line) != 0; + bool test_end= !std::getline(test_stream, test_line); + bool gold_end= !std::getline(gold_stream, gold_line); if (!(test_end || gold_end)) { return true; } diff --git a/modules/config/base.hh b/modules/config/base.hh index 2019437b5b47828492ec8de2422a77287d650092..ade55f5fca97d5742b18650d287d5f46e66d8657 100644 --- a/modules/config/base.hh +++ b/modules/config/base.hh @@ -51,28 +51,40 @@ typedef unsigned int uint; typedef std::complex<Real> Complex; typedef unsigned short Word; +typedef std::string String; - -#ifndef round_function -#define round_function -#ifndef round -inline Real round( Real d ) +#ifndef round_real_function +#define round_real_function +#ifndef round_real +inline Real round_real(Real d) { return floor(d+Real(0.5)); } #endif #endif -#ifndef rint_function -#define rint_function -#ifndef rint -inline Real rint(Real d) +#ifndef round_float_function +#define round_float_function +#ifndef round_float +inline float round_float(float d) { - return floor(d+Real(0.5)); + return (float)floor(d+float(0.5)); +} +#endif +#endif + +#ifndef round_double_function +#define round_double_function +#ifndef round_double +inline double round_double(double d) +{ + return (double)floor(d+double(0.5)); } #endif #endif + + #if _MSC_VER #pragma warning(disable:4251) #pragma warning(disable:4275) @@ -104,7 +116,5 @@ inline double log2( double n ) #endif -typedef std::string String; - #endif diff --git a/modules/gfx/src/impl/cartoon_renderer.cc b/modules/gfx/src/impl/cartoon_renderer.cc index 00894483df3e7c0e3433463810fb403a80a84a46..060668cceb97db9512e150485ed5b29c91ac1a4a 100644 --- a/modules/gfx/src/impl/cartoon_renderer.cc +++ b/modules/gfx/src/impl/cartoon_renderer.cc @@ -380,7 +380,7 @@ void CartoonRenderer::rebuild_spline_obj(IndexedVertexArray& va, double ang=-geom::SignedAngle(geom::Cross(slist.at(sc-1).normal,dir), geom::Cross(slist.at(sc).normal,dir), dir); - offset=psize+static_cast<size_t>(round(ang*of)+psized); + offset=psize+static_cast<size_t>(round_real(ang*of)+psized); } if(slist.at(sc).type==3) { if(slist.at(sc-1).type!=3) { diff --git a/modules/gfx/src/scene.cc b/modules/gfx/src/scene.cc index 5c1e9cbb7149115b219ceccc8e88698fa5e70e97..98b47c9cbb16ed2477cb5fb0fd001bcaee8f0c57 100644 --- a/modules/gfx/src/scene.cc +++ b/modules/gfx/src/scene.cc @@ -1097,7 +1097,7 @@ bool Scene::HasNode(const String& name) const { FindNode fn(name); this->Apply(fn); - return fn.node; + return static_cast<bool>(fn.node); } void Scene::Apply(const InputEvent& e, bool request_redraw) diff --git a/modules/gfx/src/texture.hh b/modules/gfx/src/texture.hh index aa3fec45f8f0a5d288d977dd290e40210a9c5253..cf25b9d4f83a8c86d442d4b82db0ac0346d8b433 100644 --- a/modules/gfx/src/texture.hh +++ b/modules/gfx/src/texture.hh @@ -51,7 +51,7 @@ public: Texture(const Bitmap& b); - bool IsValid() const {return d_;} + bool IsValid() const {return static_cast<bool>(d_);} float* data() {return &d_[0];} diff --git a/modules/gfx/src/vertex_array.cc b/modules/gfx/src/vertex_array.cc index 520e0d0e9c95f640c3578b99af95090e7f4aabec..a1f61d40b9850d02eff23c14c81b6e5533072673 100644 --- a/modules/gfx/src/vertex_array.cc +++ b/modules/gfx/src/vertex_array.cc @@ -508,7 +508,7 @@ namespace { unsigned int col_to_index(float* c) { // don't look too closely - I am lacking sufficient caffeine to do this more elegantly - int ret= std::max(0,std::min<int>(511,static_cast<int>(round(c[0]*7.0f))*64+static_cast<int>(round(c[1]*7.0f))*8+static_cast<unsigned int>(round(c[2]*7.0f)))); + int ret= std::max(0,std::min<int>(511,static_cast<int>(round_real(c[0]*7.0f))*64+static_cast<int>(round_real(c[1]*7.0f))*8+static_cast<unsigned int>(round_real(c[2]*7.0f)))); return static_cast<unsigned int>(ret); } } diff --git a/modules/gui/src/data_viewer/data_viewer.hh b/modules/gui/src/data_viewer/data_viewer.hh index ca6893edc34895fde6df19e2b1344ea11affcb98..c1f18847ec36c270de0d93183342c8427dd604a1 100644 --- a/modules/gui/src/data_viewer/data_viewer.hh +++ b/modules/gui/src/data_viewer/data_viewer.hh @@ -25,6 +25,8 @@ #ifndef IMG_GUI_DATA_VIEWER_H #define IMG_GUI_DATA_VIEWER_H +#ifndef Q_MOC_RUN + #include <map> #include <ost/base.hh> @@ -42,6 +44,9 @@ #include "fft_panel.hh" #include <ost/gui/module_config.hh> +#endif + + //fw decl class QLabel; diff --git a/modules/gui/src/data_viewer/data_viewer_panel_base.hh b/modules/gui/src/data_viewer/data_viewer_panel_base.hh index 699efd372cad4dc5b0a9f26a205b4487f5b33168..be3ac007ec7550c4242e8cbc607654c5eca12fea 100644 --- a/modules/gui/src/data_viewer/data_viewer_panel_base.hh +++ b/modules/gui/src/data_viewer/data_viewer_panel_base.hh @@ -26,10 +26,10 @@ #define DATA_VIEWER_PANEL_BASE_HH_ #include <map> -#include <boost/shared_ptr.hpp> - +#ifndef Q_MOC_RUN +#include <boost/shared_ptr.hpp> #include <ost/base.hh> #include <ost/img/extent.hh> #include <ost/img/data_observer.hh> @@ -41,6 +41,8 @@ #include <ost/img/normalizer_impl.hh> +#endif + #include <QWidget> #include <QCursor> #include <QMenu> diff --git a/modules/gui/src/data_viewer/drawing_functions.cc b/modules/gui/src/data_viewer/drawing_functions.cc index f27b3eb0dfe2894527b1d3658d716027e35c50b9..324c29af9898bc28f95b35bcb0c44e38a3be17c1 100644 --- a/modules/gui/src/data_viewer/drawing_functions.cc +++ b/modules/gui/src/data_viewer/drawing_functions.cc @@ -64,7 +64,7 @@ void DrawEllipse(QPainter& pnt, const QPoint& center, Real rx, Real ry, Real ang Real ang=static_cast<Real>(j)/static_cast<Real>(numpoints)*2.0*M_PI; Real dx=rx*cos(ang); Real dy=ry*sin(ang); - qpoly << QPoint(static_cast<int>(round(center.x()+dx*cos(-angle)+dy*sin(-angle))),static_cast<int>(round(center.y()-dx*sin(-angle)+dy*cos(-angle)))); + qpoly << QPoint(static_cast<int>(round_real(center.x()+dx*cos(-angle)+dy*sin(-angle))),static_cast<int>(round_real(center.y()-dx*sin(-angle)+dy*cos(-angle)))); } pnt.drawPolyline(qpoly); } @@ -86,13 +86,13 @@ void DrawHyperbola(QPainter& pnt, const QSize& size, const geom::Vec2& center, R x=sqrt((y*y/ry/ry-1.0)*rx*rx); } geom::Vec2 pos=Rotate(Vec2(x,y),-angle)+center; - p1=QPoint(static_cast<int>(round(pos[0])),static_cast<int>(round(pos[1]))); + p1=QPoint(static_cast<int>(round_real(pos[0])),static_cast<int>(round_real(pos[1]))); pos=Rotate(Vec2(x,-y),-angle)+center; - p2=QPoint(static_cast<int>(round(pos[0])),static_cast<int>(round(pos[1]))); + p2=QPoint(static_cast<int>(round_real(pos[0])),static_cast<int>(round_real(pos[1]))); pos=Rotate(Vec2(-x,y),-angle)+center; - p3=QPoint(static_cast<int>(round(pos[0])),static_cast<int>(round(pos[1]))); + p3=QPoint(static_cast<int>(round_real(pos[0])),static_cast<int>(round_real(pos[1]))); pos=Rotate(Vec2(-x,-y),-angle)+center; - p4=QPoint(static_cast<int>(round(pos[0])),static_cast<int>(round(pos[1]))); + p4=QPoint(static_cast<int>(round_real(pos[0])),static_cast<int>(round_real(pos[1]))); if(orientation){ if(flagp1){ points1.push_back(p1); @@ -150,7 +150,7 @@ void DrawHalfEllipse(QPainter& pnt, const QPoint& center, Real rx, Real ry, Real Real ang=j/static_cast<Real>(numpoints)*M_PI+M_PI; Real dx=rx*cos(ang); Real dy=ry*sin(ang); - qpoly << QPoint(static_cast<int>(round(center.x()+dx*cos(-angle)+dy*sin(-angle))),static_cast<int>(round(center.y()-dx*sin(-angle)+dy*cos(-angle)))); + qpoly << QPoint(static_cast<int>(round_real(center.x()+dx*cos(-angle)+dy*sin(-angle))),static_cast<int>(round_real(center.y()-dx*sin(-angle)+dy*cos(-angle)))); } pnt.drawPolyline(qpoly); } diff --git a/modules/gui/src/data_viewer/fft_panel.hh b/modules/gui/src/data_viewer/fft_panel.hh index 75a30fed87e8a1018887d10a56fd7e0465674ce0..ac0df0f56e39d148ab16735fe6e7fe3ce082244e 100644 --- a/modules/gui/src/data_viewer/fft_panel.hh +++ b/modules/gui/src/data_viewer/fft_panel.hh @@ -24,10 +24,14 @@ Author: Andreas Schenk */ +#ifndef Q_MOC_RUN + #include <ost/gui/module_config.hh> #include <ost/img/data_observer.hh> #include "data_viewer_panel_base.hh" +#endif + namespace ost { namespace img { namespace gui { class ParentDataObserver: public DataObserver diff --git a/modules/gui/src/file_type_dialog.hh b/modules/gui/src/file_type_dialog.hh index f1fe6ce5e5fc6e856b15c091b65d03e41309bda2..270d35131d96f77ebfee4de64420abe4f933590d 100644 --- a/modules/gui/src/file_type_dialog.hh +++ b/modules/gui/src/file_type_dialog.hh @@ -25,7 +25,7 @@ #include <ost/gui/module_config.hh> - +#ifndef Q_MOC_RUN #include <ost/io/mol/entity_io_handler.hh> #include <ost/io/seq/sequence_io_handler.hh> @@ -34,6 +34,8 @@ #include <ost/io/img/map_io_handler.hh> #endif +#endif + #include <QDialog> #include <QMetaType> diff --git a/modules/img/alg/src/polar.cc b/modules/img/alg/src/polar.cc index aa5fa3745ddb80a6db9b932d573d4444304d0ffc..dc77c06553947c20cab3cf3b096fe53524d6eb5e 100644 --- a/modules/img/alg/src/polar.cc +++ b/modules/img/alg/src/polar.cc @@ -36,7 +36,7 @@ public: ImageStateBasePtr VisitState(const img::ImageStateImpl<T,D>& isi) { Size s=isi.GetExtent().GetSize(); // unsigned int rmax=static_cast<unsigned int>(std::min(s[0],s[1])*0.5); - unsigned int rmax=static_cast<unsigned int>(round(sqrt(s[0]*s[0]+s[1]*s[1])*0.5)); + unsigned int rmax=static_cast<unsigned int>(round_real(sqrt(s[0]*s[0]+s[1]*s[1])*0.5)); Extent e(Size(rmax,static_cast<unsigned int>(rmax*2.0*M_PI*sampling_))); std::cerr << e << std::endl; boost::shared_ptr<ImageStateImpl<T,image_state::SpatialDomain> > result(new ImageStateImpl<T,image_state::SpatialDomain>(e,isi.GetSampling())); @@ -76,7 +76,7 @@ ImageHandle Polar::Visit(const ConstImageHandle& i) #else Size s=i.GetExtent().GetSize(); // unsigned int rmax=static_cast<unsigned int>(std::min(s[0],s[1])*0.5); - unsigned int rmax=static_cast<unsigned int>(round(sqrt(static_cast<double>(s[0]*s[0]+s[1]*s[1]))*0.5)); + unsigned int rmax=static_cast<unsigned int>(round_double(sqrt(static_cast<double>(s[0]*s[0]+s[1]*s[1]))*0.5)); Extent e(Size(rmax,static_cast<unsigned int>(rmax*2.0*M_PI*sampling_))); ImageHandle result = CreateImage(e,i.GetType(),SPATIAL); Real prefac=1/(rmax*sampling_); @@ -103,7 +103,7 @@ ImageHandle EllipticPolar::Visit(const ConstImageHandle& i) Size s=i.GetExtent().GetSize(); Real ang=atan(static_cast<double>(s[1]/s[0])); Real mdist=std::min(Length(ellipse.AtAngle(ang)),Length(ellipse.AtAngle(-ang))); - unsigned int rmax=static_cast<unsigned int>(round(sqrt(static_cast<double>(s[0]*s[0]+s[1]*s[1]))*0.5)); + unsigned int rmax=static_cast<unsigned int>(round_double(sqrt(static_cast<double>(s[0]*s[0]+s[1]*s[1]))*0.5)); Extent e(Size(rmax,static_cast<unsigned int>(rmax*2.0*M_PI*sampling_))); ImageHandle result = CreateImage(e,i.GetType(),SPATIAL); Real prefac=1/(rmax*sampling_); diff --git a/modules/img/base/src/base.hh b/modules/img/base/src/base.hh index 0122a07371705cdc89808f6f3966ab67cb9e2e6a..f5d73f5f4f1aa18f897d6e4710d5108ae7380bbc 100644 --- a/modules/img/base/src/base.hh +++ b/modules/img/base/src/base.hh @@ -44,21 +44,11 @@ #pragma warning(disable:4231) #endif - #ifdef IRIX -inline Real round(Real x) {return rint(x);} -inline float roundf(float x) {return (float)rint((Real)x);} using std::cos; using std::sin; #endif -#ifndef round_function -#define round_function -#ifndef round -inline int round(Real x) {return floor(x+0.5);} -#endif -#endif - namespace ost { namespace img { // String is not always predefined diff --git a/modules/img/base/src/image_handle.cc b/modules/img/base/src/image_handle.cc index c0059be0b852490c5e50306fffab6fca18f23208..fe84239cd624c3c3e6584151ddff9ecf1dffca3d 100644 --- a/modules/img/base/src/image_handle.cc +++ b/modules/img/base/src/image_handle.cc @@ -153,7 +153,7 @@ void ImageHandle::Reset(const Extent &e, DataType type,DataDomain dom) bool ImageHandle::IsValid() const { - return impl_; + return static_cast<bool>(impl_); } long ImageHandle::MemSize() const diff --git a/modules/img/base/src/image_list.cc b/modules/img/base/src/image_list.cc index 522e5f7af76c67f2b171ec5ad6f07e9782adef4c..a0f5365f16ce6b28d79c9c7274ebf9af11f9e37a 100644 --- a/modules/img/base/src/image_list.cc +++ b/modules/img/base/src/image_list.cc @@ -43,9 +43,9 @@ ImageHandle ImageList::GetGallery(unsigned int columns,bool border) bsize=1; } if(columns==0){ - columns=static_cast<int>(round(sqrt(static_cast<Real>(size())))); + columns=static_cast<int>(round_real(sqrt(static_cast<Real>(size())))); } - unsigned int rows=static_cast<int>(round(static_cast<Real>(size())/static_cast<Real>(columns))); + unsigned int rows=static_cast<int>(round_real(static_cast<Real>(size())/static_cast<Real>(columns))); Size s=get_max_size_(); DataType datatype=get_data_type_(); if(s[2]>1){ diff --git a/modules/img/base/src/point.hh b/modules/img/base/src/point.hh index 0d9f307e7c5f48d7170ebdece6e07e17f38cc868..0795303854f85f1fc28ac90a03d2f9f7815f8083 100644 --- a/modules/img/base/src/point.hh +++ b/modules/img/base/src/point.hh @@ -87,8 +87,8 @@ public: //! conversion from Vec2 explicit Point(const Vec2& v): - x(static_cast<int>(round(v[0]))), - y(static_cast<int>(round(v[1]))), + x(static_cast<int>(round_real(v[0]))), + y(static_cast<int>(round_real(v[1]))), z() { } @@ -96,18 +96,18 @@ public: //! conversion from Vec3 explicit Point(const Vec3& v): - x(static_cast<int>(round(v[0]))), - y(static_cast<int>(round(v[1]))), - z(static_cast<int>(round(v[2]))) + x(static_cast<int>(round_real(v[0]))), + y(static_cast<int>(round_real(v[1]))), + z(static_cast<int>(round_real(v[2]))) { } //! conversion from Vec4 (normalization) explicit Point(const Vec4& v): - x(static_cast<int>(round(v[0]))), - y(static_cast<int>(round(v[1]))), - z(static_cast<int>(round(v[2]))) + x(static_cast<int>(round_real(v[0]))), + y(static_cast<int>(round_real(v[1]))), + z(static_cast<int>(round_real(v[2]))) { if(std::abs(v[3])<1e-100) { throw geom::OutOfRangeException("4th element of Vec4 is too close to zero for normalization"); diff --git a/modules/img/base/src/raster_image/raster_image.cc b/modules/img/base/src/raster_image/raster_image.cc index 143e1110b2c0e739a5c1b522886e54a409aeacfa..febbe0314316f77ac0bd9a046a0cd9080d6704a0 100644 --- a/modules/img/base/src/raster_image/raster_image.cc +++ b/modules/img/base/src/raster_image/raster_image.cc @@ -191,7 +191,7 @@ RasterImage::Pixel get_value_t(const Data& d, const Point& p, const geom::Vec3& if(signcolor) vv = std::abs(vv); rv = n->Convert(vv); } - uchar v = (unsigned char)::round(rv); + uchar v = (unsigned char)::round_real(rv); if(signcolor) { float hsv[3]; hsv[0] = sg ? 0.0 : 120.0; @@ -268,7 +268,7 @@ RasterImage::Pixel isi_to_pixel(const ImageStateImpl<T,D>& isi, } else { rv = n->Convert(Val2Val<T,Real>(isi.Value(p))); } - uchar v = (unsigned char)::round(rv); + uchar v = (unsigned char)::round_real(rv); return RasterImage::Pixel(v,v,v); } diff --git a/modules/info/src/info_handle.cc b/modules/info/src/info_handle.cc index 9b6ecbc49a7dac0caddd7347743f9dd634cdee2c..263ae222c9ed261b0de6061631dfb94e98753bee 100644 --- a/modules/info/src/info_handle.cc +++ b/modules/info/src/info_handle.cc @@ -74,7 +74,7 @@ void InfoHandle::Export(const String& file) const bool InfoHandle::IsValid() const { - return impl_; + return static_cast<bool>(impl_); } diff --git a/modules/info/src/item_type_cast.hh b/modules/info/src/item_type_cast.hh index 0b364d575a31737eec8e0f6fa775d5b1a14956dd..89c0aedfa4f24188c2eb4ce72d0f1fd5e03411ef 100644 --- a/modules/info/src/item_type_cast.hh +++ b/modules/info/src/item_type_cast.hh @@ -163,7 +163,7 @@ template <> void set_new_type<IT_FLOAT,IT_STRING>(EleImpl& item) template <> void set_new_type<IT_FLOAT,IT_INT>(EleImpl& item) { - item.SetIntRepr(static_cast<int>(round(item.GetFloatRepr()))); + item.SetIntRepr(static_cast<int>(round_real(item.GetFloatRepr()))); } template <> void set_new_type<IT_FLOAT,IT_FLOAT>(EleImpl& item) diff --git a/modules/io/src/formatted_line.hh b/modules/io/src/formatted_line.hh index 444a4e4aaf75c14452b868d4b5a857cc28fa956c..40772bc1810b8734ff22c2bb22131601ff9ce583 100644 --- a/modules/io/src/formatted_line.hh +++ b/modules/io/src/formatted_line.hh @@ -88,7 +88,7 @@ struct LPaddedFloat { len = snprintf(data, sizeof(data), "%.3f", val); break; default: - Real rounded_val=round(val*pow(Real(10), prec))*pow(Real(0.1), prec); + Real rounded_val=round_real(val*pow(Real(10), prec))*pow(Real(0.1), prec); size_t curr=0; bool minus=rounded_val<0; rounded_val=std::abs(rounded_val); diff --git a/modules/io/src/img/map_io_tiff_handler.cc b/modules/io/src/img/map_io_tiff_handler.cc index cd0ad364c112f65118498e292194cc1749f9e422..b4742964200d5f5b12041869996e0f78988f60d8 100644 --- a/modules/io/src/img/map_io_tiff_handler.cc +++ b/modules/io/src/img/map_io_tiff_handler.cc @@ -847,11 +847,11 @@ void MapIOTiffHandler::load_image_data(TIFF* tfile, img::ImageHandle& image, co break; case RESUNIT_INCH: image.SetPixelSampling(geom::Vec3(xreso*Units::in,yreso*Units::in,1)); - image.SetSpatialOrigin(img::Point(static_cast<int>(round(xpos/xreso)),static_cast<int>(round(ypos/yreso)),0)); + image.SetSpatialOrigin(img::Point(static_cast<int>(round_float(xpos/xreso)),static_cast<int>(round_float(ypos/yreso)),0)); break; case RESUNIT_CENTIMETER: image.SetPixelSampling(geom::Vec3(xreso*Units::cm,yreso*Units::cm,1)); - image.SetSpatialOrigin(img::Point(static_cast<int>(round(xpos/xreso)),static_cast<int>(round(ypos/yreso)),0)); + image.SetSpatialOrigin(img::Point(static_cast<int>(round_float(xpos/xreso)),static_cast<int>(round_float(ypos/yreso)),0)); break; } _TIFFfree(buf); diff --git a/modules/io/tests/test_io_mmcif.py b/modules/io/tests/test_io_mmcif.py index c7cb807bcca47a281aaa0b9e46b3a41724a6dcf9..25cadebe64f0af4e4c92e7e8647228d18ab01d2d 100644 --- a/modules/io/tests/test_io_mmcif.py +++ b/modules/io/tests/test_io_mmcif.py @@ -150,7 +150,7 @@ class TestMMCifInfo(unittest.TestCase): [mol.ResNum(1), mol.ResNum(2), mol.ResNum(3), mol.ResNum(4)]) def test_mmcifinfo_biounit_pdbize(self): - ent, seqres, info = io.LoadMMCIF("testfiles/mmcif/3T6C.cif.gz", + ent, seqres, info = io.LoadMMCIF("testfiles/mmcif/3T6C.cif", seqres=True, info=True) pdb_ent = info.GetBioUnits()[0].PDBize(ent) diff --git a/modules/io/tests/test_mmcif_reader.cc b/modules/io/tests/test_mmcif_reader.cc index 2cfac7fcef03a65e57d20a6658ad07f90b339ab6..6c97689dcc0026fb2b95fb69f127860c7b6e874a 100644 --- a/modules/io/tests/test_mmcif_reader.cc +++ b/modules/io/tests/test_mmcif_reader.cc @@ -1327,7 +1327,8 @@ BOOST_AUTO_TEST_CASE(mmcif_test_chain_mappings) BOOST_TEST_MESSAGE(" Running mmcif_test_chain_mappings tests..."); // check compound lib - bool compound_lib_available = SetDefaultCompoundLib(); + bool compound_lib_available = + static_cast<bool>(SetDefaultCompoundLib()); // load data mol::EntityHandle eh = mol::CreateEntity(); diff --git a/modules/mol/alg/src/entity_to_density.cc b/modules/mol/alg/src/entity_to_density.cc index b6ac49efcb2d10188f9a7879c8b7f653b7997f93..002b7ff1e8f0d14d02567d281494a4e3501e9fa0 100644 --- a/modules/mol/alg/src/entity_to_density.cc +++ b/modules/mol/alg/src/entity_to_density.cc @@ -307,9 +307,9 @@ public: geom::Vec3 adjusted_coord = coord-map_start; geom::Vec3 pixel_coord=is.CoordToIndex(coord); - img::Point rounded_pixel_coord(round(pixel_coord[0]), - round(pixel_coord[1]), - round(pixel_coord[2])); + img::Point rounded_pixel_coord(round_real(pixel_coord[0]), + round_real(pixel_coord[1]), + round_real(pixel_coord[2])); uint x_limit = ceil(2.0*four_sigma/sampling[0])+1; uint y_limit = ceil(2.0*four_sigma/sampling[1])+1; diff --git a/modules/mol/alg/src/filter_clashes.cc b/modules/mol/alg/src/filter_clashes.cc index 690a10aff11a238a45663186ac6b98c3ace29db5..b2f9f6112d8598df6b78bdc2ed32dd8df39d871c 100644 --- a/modules/mol/alg/src/filter_clashes.cc +++ b/modules/mol/alg/src/filter_clashes.cc @@ -118,7 +118,7 @@ std::pair<Real,Real> ClashingDistances::GetClashingDistance(const String& ele1,c std::map <String,std::pair<Real,Real> >::const_iterator find_ci= min_distance_.find(key); if (find_ci == min_distance_.end()) { std::stringstream serr; - serr << "Entry for distance " << stkey << " not found in the parameter table"; + serr << "Entry for distance " << key << " not found in the parameter table"; throw Error(serr.str()); } return find_ci->second; @@ -207,7 +207,7 @@ StereoChemicalParams FillStereoChemicalParams(const String& header, std::vector< bool found=false; std::vector<String>::const_iterator line_iter=stereo_chemical_props_file.begin(); while (line_iter!=stereo_chemical_props_file.end()) { - if ((*line_iter).length() > 1) { + if ((*line_iter).length()!=0 && (*line_iter).length()!=1) { StringRef line_string_ref(line_iter->data(),(*line_iter).length()); std::vector<StringRef> line_str_vec = line_string_ref.split(); if (line_str_vec[0].str()==header) { @@ -266,8 +266,8 @@ StereoChemicalParams FillStereoChemicalParams(const String& header, std::vector< return StereoChemicalParams(); } table.SetParam(rearranged_item,res,value,stddev); - } - line_iter++; + line_iter++; + } } } } @@ -286,7 +286,7 @@ ClashingDistances FillClashingDistances(std::vector<String>& stereo_chemical_pro bool found=false; std::vector<String>::const_iterator line_iter=stereo_chemical_props_file.begin(); while (line_iter!=stereo_chemical_props_file.end()) { - if ((*line_iter).length() > 1) { + if ((*line_iter).length()!=0 && (*line_iter).length()!=1) { StringRef line_string_ref(line_iter->data(),(*line_iter).length()); std::vector<StringRef> line_str_vec = line_string_ref.split(); if (line_str_vec[0].str()=="Non-bonded") { @@ -329,11 +329,11 @@ ClashingDistances FillClashingDistances(std::vector<String>& stereo_chemical_pro table.SetClashingDistance(ele2,ele1,value,stddev); } else { table.SetClashingDistance(ele1,ele2,value,stddev); - } - } - line_iter++; + } + line_iter++; + } } - } + } } line_iter++; } diff --git a/modules/mol/base/src/bond_handle.cc b/modules/mol/base/src/bond_handle.cc index 3be1b88bd7017c7005e2912a71d689bb398576bc..9a68a860dc5db33eea4a28fdc807407acb889ec1 100644 --- a/modules/mol/base/src/bond_handle.cc +++ b/modules/mol/base/src/bond_handle.cc @@ -47,7 +47,7 @@ BondHandle::operator bool() const } bool BondHandle::IsValid() const { - return impl_; + return static_cast<bool>(impl_); } AtomHandle BondHandle::GetFirst() const diff --git a/modules/mol/base/src/impl/atom_impl.cc b/modules/mol/base/src/impl/atom_impl.cc index 7bc585b14662360f400d241ca77e4a48ee8b1184..f0852b73845a7ae3181109154203f40a3435d64c 100644 --- a/modules/mol/base/src/impl/atom_impl.cc +++ b/modules/mol/base/src/impl/atom_impl.cc @@ -227,7 +227,7 @@ std::ostream& operator<<(std::ostream& o, const AtomImplPtr ap) } bool ConnectorExists(const AtomImplPtr& a, const AtomImplPtr& b) { - return GetConnector(a, b); + return static_cast<bool>(GetConnector(a, b)); } ConnectorImplP GetConnector(const AtomImplPtr& a, const AtomImplPtr& b) { diff --git a/modules/mol/base/src/spatial_organizer.hh b/modules/mol/base/src/spatial_organizer.hh index 0e9dce74005141d9103453a806a475704d0ba2b2..c48c0f293c1cc27cd990ae5e18522aa1a288b167 100644 --- a/modules/mol/base/src/spatial_organizer.hh +++ b/modules/mol/base/src/spatial_organizer.hh @@ -215,9 +215,9 @@ private: Index max_; Index gen_index(const VEC& pos) const { - Index nrvo(static_cast<int>(round(pos[0]/delta_)), - static_cast<int>(round(pos[1]/delta_)), - static_cast<int>(round(pos[2]/delta_))); + Index nrvo(static_cast<int>(round_real(pos[0]/delta_)), + static_cast<int>(round_real(pos[1]/delta_)), + static_cast<int>(round_real(pos[2]/delta_))); return nrvo; } diff --git a/modules/mol/base/src/surface_handle.hh b/modules/mol/base/src/surface_handle.hh index 3524375d36ab919f072d3a8d19fe78d4e74d387b..a11b3a91e9768535716c30e25f5026e8fdc04c44 100644 --- a/modules/mol/base/src/surface_handle.hh +++ b/modules/mol/base/src/surface_handle.hh @@ -70,7 +70,7 @@ public: // flip normals void Invert(); - bool IsValid() const {return impl_;} + bool IsValid() const {return static_cast<bool>(impl_);} bool operator==(const SurfaceHandle& ref) const { return impl_==ref.impl_; } diff --git a/modules/mol/mm/src/modeller.cc b/modules/mol/mm/src/modeller.cc index 1a9da309452b9c0926fd3e1d27dff00dc6120f89..03f1f72c45287a47b9d46177961bdd31053bfb47 100644 --- a/modules/mol/mm/src/modeller.cc +++ b/modules/mol/mm/src/modeller.cc @@ -91,9 +91,9 @@ void Modeller::LowerPrecision(ost::mol::EntityHandle& handle){ for(ost::mol::AtomHandleList::iterator i = atom_list.begin(); i != atom_list.end(); ++i){ pos = i->GetPos(); - truncated_pos[0] = Real(round(pos[0]*100))/100; - truncated_pos[1] = Real(round(pos[1]*100))/100; - truncated_pos[2] = Real(round(pos[2]*100))/100; + truncated_pos[0] = Real(round_real(pos[0]*100))/100; + truncated_pos[1] = Real(round_real(pos[1]*100))/100; + truncated_pos[2] = Real(round_real(pos[2]*100))/100; ed.SetAtomPos(*i,truncated_pos); } ed.UpdateICS();