From 97d4bf7ce2165172a153d88503dd2889893c1655 Mon Sep 17 00:00:00 2001 From: Max Voronkov Date: Thu, 26 May 2022 13:37:33 +1000 Subject: [PATCH 1/7] fixed deprecation warnings related to Table interface --- .../ComponentModels/test/tFluxStandard2.cc | 11 ++++++----- synthesis/MeasurementComponents/BPoly.cc | 10 ++++------ synthesis/MeasurementComponents/Calibrater.cc | 7 ++++--- synthesis/MeasurementComponents/GSpline.cc | 6 ++++-- .../MeasurementComponents/SolvableVisCal.cc | 4 +++- synthesis/MeasurementComponents/WPConvFunc.cc | 13 +++++-------- synthesis/MeasurementEquations/Imager.cc | 17 +++++++++-------- synthesis/apps/lwimager.cc | 4 +++- 8 files changed, 38 insertions(+), 34 deletions(-) diff --git a/components/ComponentModels/test/tFluxStandard2.cc b/components/ComponentModels/test/tFluxStandard2.cc index cd6b6e5..abbc35c 100644 --- a/components/ComponentModels/test/tFluxStandard2.cc +++ b/components/ComponentModels/test/tFluxStandard2.cc @@ -44,6 +44,7 @@ #include // Needed by ComponentList #include #include +#include #include int main(int argc, char* argv[]) @@ -245,10 +246,10 @@ int main(int argc, char* argv[]) AipsError); cout << "\tPassed flux density test." << endl; if(tempCLs[spwInd] != ""){ - if(Table::canDeleteTable(tempCLs[spwInd])) - Table::deleteTable(tempCLs[spwInd]); + if(TableUtil::canDeleteTable(tempCLs[spwInd])) + TableUtil::deleteTable(tempCLs[spwInd]); else - cout << "Table::canDeleteTable(" << tempCLs[spwInd] + cout << "TableUtil::canDeleteTable(" << tempCLs[spwInd] << ") returned False" << endl; } } @@ -298,8 +299,8 @@ int main(int argc, char* argv[]) } } if(tempCLs[0] != ""){ - if(Table::canDeleteTable(tempCLs[0])) - Table::deleteTable(tempCLs[0]); + if(TableUtil::canDeleteTable(tempCLs[0])) + TableUtil::deleteTable(tempCLs[0]); else cout << "Table::canDeleteTable(" << tempCLs[0] << ") returned False" << endl; diff --git a/synthesis/MeasurementComponents/BPoly.cc b/synthesis/MeasurementComponents/BPoly.cc index 8572f58..266a1a0 100644 --- a/synthesis/MeasurementComponents/BPoly.cc +++ b/synthesis/MeasurementComponents/BPoly.cc @@ -41,11 +41,9 @@ #include #include #include -#if defined(casacore) +#include +#include #include -#else -#include -#endif namespace casacore { //# NAMESPACE CASACORE - BEGIN @@ -146,8 +144,8 @@ void BJonesPoly::setSolve(const Record& solvepar) // Delete calTableName() if it exists and we are not appending // TBD: move to SVC? if (!append()) { - if (Table::canDeleteTable(calTableName())) { - Table::deleteTable(calTableName()); + if (TableUtil::canDeleteTable(calTableName())) { + TableUtil::deleteTable(calTableName()); } // else // throw(AipsError(calTableName()+" exists and can't delete! (plotting or browsing it?)")); diff --git a/synthesis/MeasurementComponents/Calibrater.cc b/synthesis/MeasurementComponents/Calibrater.cc index d9c1758..a1bb3c9 100644 --- a/synthesis/MeasurementComponents/Calibrater.cc +++ b/synthesis/MeasurementComponents/Calibrater.cc @@ -26,6 +26,7 @@ //# $Id: Calibrater.cc,v 19.37 2006/03/16 01:28:09 gmoellen Exp $ #include +#include #include #include #include @@ -1287,7 +1288,7 @@ Bool Calibrater::solve() { // then it better be deletable if (!svc_p->append() && Table::isReadable(svc_p->calTableName()) && - !Table::canDeleteTable(svc_p->calTableName()) ) { + !TableUtil::canDeleteTable(svc_p->calTableName()) ) { //cout << "Table CAN'T be deleted!!!!!" << endl; throw(AipsError("Specified caltable ("+svc_p->calTableName()+") exists and\n cannot be replaced because it appears to be open somewhere.")); @@ -1994,11 +1995,11 @@ void Calibrater::fluxscale(const String& infile, try { // If infile is Calibration table if (Table::isReadable(infile) && - Table::tableInfo(infile).type()=="Calibration") { + TableUtil::tableInfo(infile).type()=="Calibration") { // get calibration type String caltype; - caltype = Table::tableInfo(infile).subType(); + caltype = TableUtil::tableInfo(infile).subType(); logSink() << "Table " << infile << " is of type: "<< caltype << LogIO::POST; diff --git a/synthesis/MeasurementComponents/GSpline.cc b/synthesis/MeasurementComponents/GSpline.cc index 6ba99cd..8469230 100644 --- a/synthesis/MeasurementComponents/GSpline.cc +++ b/synthesis/MeasurementComponents/GSpline.cc @@ -39,6 +39,8 @@ #include #include +#include +#include #include #include #include @@ -1051,8 +1053,8 @@ void GJonesSpline::updateCalTable (const Vector& fieldIdKeys, calBuffer_p->timeMeas().set(MEpoch(MVEpoch(solTimeStamp_p/86400.0))); // Delete the output calibration table if it already exists - if (calTableName()!="" && Table::canDeleteTable(calTableName())) { - Table::deleteTable(calTableName()); + if (calTableName()!="" && TableUtil::canDeleteTable(calTableName())) { + TableUtil::deleteTable(calTableName()); }; os << LogIO::NORMAL diff --git a/synthesis/MeasurementComponents/SolvableVisCal.cc b/synthesis/MeasurementComponents/SolvableVisCal.cc index 2184322..179f8b2 100644 --- a/synthesis/MeasurementComponents/SolvableVisCal.cc +++ b/synthesis/MeasurementComponents/SolvableVisCal.cc @@ -30,6 +30,8 @@ #include +#include +#include #include #include #include @@ -5651,7 +5653,7 @@ String calTableType(const String& tablename) { // Table exists... - TableInfo ti(Table::tableInfo(tablename)); + TableInfo ti(TableUtil::tableInfo(tablename)); // ...Check if Calibration table.... if (ti.type()!="Calibration") { diff --git a/synthesis/MeasurementComponents/WPConvFunc.cc b/synthesis/MeasurementComponents/WPConvFunc.cc index 848b97e..55bff7d 100644 --- a/synthesis/MeasurementComponents/WPConvFunc.cc +++ b/synthesis/MeasurementComponents/WPConvFunc.cc @@ -51,18 +51,15 @@ #include #include #include -#if defined(casacore) #include #include #include -#else -#include -#include -#include -#endif #include #include #include +#include +#include + #include @@ -261,7 +258,7 @@ namespace casacore { //# NAMESPACE CASACORE - BEGIN if(writeResults) { ostringstream name; name << "Screen" << iw+1; - if(Table::canDeleteTable(name)) Table::deleteTable(name); + if(TableUtil::canDeleteTable(name)) TableUtil::deleteTable(name); PagedImage thisScreen(pbShape, coords, name); LatticeExpr le(real(twoDPB)); thisScreen.copyData(le); @@ -283,7 +280,7 @@ namespace casacore { //# NAMESPACE CASACORE - BEGIN delete ftdc; ftdc=0; ostringstream name; name << "FTScreen" << iw+1; - if(Table::canDeleteTable(name)) Table::deleteTable(name); + if(TableUtil::canDeleteTable(name)) TableUtil::deleteTable(name); PagedImage thisScreen(pbShape, ftCoords, name); LatticeExpr le(real(twoDPB)); thisScreen.copyData(le); diff --git a/synthesis/MeasurementEquations/Imager.cc b/synthesis/MeasurementEquations/Imager.cc index 8f73572..eed1e13 100644 --- a/synthesis/MeasurementEquations/Imager.cc +++ b/synthesis/MeasurementEquations/Imager.cc @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -2516,8 +2517,8 @@ Bool Imager::feather(const String& image, const String& highRes, } if(noStokes){ - Table::deleteTable(outHighRes); - Table::deleteTable(outLowRes); + TableUtil::deleteTable(outHighRes); + TableUtil::deleteTable(outLowRes); } return True; } catch (AipsError x) { @@ -4791,7 +4792,7 @@ Bool Imager::setjy(const Vector& /*fieldid*/, }; // Delete the temporary component list and image tables - Table::deleteTable(tempCL); + TableUtil::deleteTable(tempCL); } } @@ -4801,7 +4802,7 @@ Bool Imager::setjy(const Vector& /*fieldid*/, } catch (AipsError x) { this->unlock(); - if(Table::canDeleteTable(tempCL)) Table::deleteTable(tempCL); + if(TableUtil::canDeleteTable(tempCL)) TableUtil::deleteTable(tempCL); os << LogIO::SEVERE << "Exception: " << x.getMesg() << LogIO::POST; return False; } @@ -5271,15 +5272,15 @@ Bool Imager::setjy(const Vector& /*fieldid*/, if (tmodimage) delete tmodimage; tmodimage=NULL; - // if (Table::canDeleteTable("temp.setjy.image")) Table::deleteTable("temp.setjy.image"); + // if (TableUtil::canDeleteTable("temp.setjy.image")) TableUtil::deleteTable("temp.setjy.image"); } // Delete the temporary component lists. Do it after ft() has been run // for all the spws because some spws with the same center frequency may // be sharing component lists. for(uInt selspw = 0; selspw < nspws; ++selspw) - if(tempCLs[selspw] != "" && Table::canDeleteTable(tempCLs[selspw])) - Table::deleteTable(tempCLs[selspw]); + if(tempCLs[selspw] != "" && TableUtil::canDeleteTable(tempCLs[selspw])) + TableUtil::deleteTable(tempCLs[selspw]); } this->writeHistory(os); this->unlock(); @@ -5289,7 +5290,7 @@ Bool Imager::setjy(const Vector& /*fieldid*/, this->unlock(); for(Int i = tempCLs.nelements(); i--;){ if(tempCLs[i] != "") - Table::deleteTable(tempCLs[i]); + TableUtil::deleteTable(tempCLs[i]); } if (tmodimage) delete tmodimage; tmodimage=NULL; os << LogIO::SEVERE << "Exception: " << x.getMesg() << LogIO::POST; diff --git a/synthesis/apps/lwimager.cc b/synthesis/apps/lwimager.cc index fcac2b9..e2ef1b5 100644 --- a/synthesis/apps/lwimager.cc +++ b/synthesis/apps/lwimager.cc @@ -27,6 +27,8 @@ //# Includes #include +#include +#include #include #include #include @@ -600,7 +602,7 @@ int main (Int argc, char** argv) himg.setImageInfo (pimg.imageInfo()); himg.setMiscInfo (pimg.miscInfo()); // Delete PagedImage if HDF5 is used. - Table::deleteTable (imgName); + TableUtil::deleteTable (imgName); } } else { From 23498cf1c02de9dc32df462f5acf0617d3c7b92f Mon Sep 17 00:00:00 2001 From: Max Voronkov Date: Tue, 14 Jan 2025 17:50:02 +1100 Subject: [PATCH 2/7] accounted for TaQLResult interface change and removal of PtrHolder and CountedPtr, code now builds against casacore-3.6.1 --- calibration/CalTables/CalTable.cc | 4 +-- calibration/CalTables/CalTable2.cc | 4 +-- components/ComponentModels/FluxStdSrcs.cc | 2 +- .../SpectralComponents/ProfileFit1D.tcc | 3 +- msvis/MSVis/MSContinuumSubtractor.cc | 2 +- synthesis/MeasurementEquations/Imager.cc | 9 +++--- .../MeasurementEquations/MatrixCleaner.cc | 29 +++++++++---------- .../MeasurementEquations/MatrixCleaner.h | 8 +++-- .../MultiTermMatrixCleaner.cc | 6 ++-- 9 files changed, 34 insertions(+), 33 deletions(-) diff --git a/calibration/CalTables/CalTable.cc b/calibration/CalTables/CalTable.cc index 59c6de8..dba8fc7 100644 --- a/calibration/CalTables/CalTable.cc +++ b/calibration/CalTables/CalTable.cc @@ -233,7 +233,7 @@ CalTable CalTable::select (const String& calSelect) return *this; } else { String parseString = "select from $1 where " + calSelect; - Table result = tableCommand (parseString, *itsMainTable); + Table result = tableCommand (parseString, *itsMainTable).table(); return CalTable (result); }; }; @@ -255,7 +255,7 @@ void CalTable::select2 (const String& calSelect) Int nspace = calSelect.freq (' '); if (!calSelect.empty() && nspace!=len) { String parseString = "select from $1 where " + calSelect; - Table *selected = new Table(tableCommand (parseString, *itsMainTable)); + Table *selected = new Table(tableCommand (parseString, *itsMainTable).table()); delete itsMainTable; itsMainTable=selected; }; diff --git a/calibration/CalTables/CalTable2.cc b/calibration/CalTables/CalTable2.cc index d5e9bdb..f5781af 100644 --- a/calibration/CalTables/CalTable2.cc +++ b/calibration/CalTables/CalTable2.cc @@ -240,7 +240,7 @@ CalTable2 CalTable2::select (const String& calSelect) return *this; } else { String parseString = "select from $1 where " + calSelect; - Table result = tableCommand (parseString, *itsMainTable); + Table result = tableCommand (parseString, *itsMainTable).table(); return CalTable2 (result); }; }; @@ -262,7 +262,7 @@ void CalTable2::select2 (const String& calSelect) Int nspace = calSelect.freq (' '); if (!calSelect.empty() && nspace!=len) { String parseString = "select from $1 where " + calSelect; - Table *selected = new Table(tableCommand (parseString, *itsMainTable)); + Table *selected = new Table(tableCommand (parseString, *itsMainTable).table()); delete itsMainTable; itsMainTable=selected; }; diff --git a/components/ComponentModels/FluxStdSrcs.cc b/components/ComponentModels/FluxStdSrcs.cc index 2589f8b..b19de4c 100644 --- a/components/ComponentModels/FluxStdSrcs.cc +++ b/components/ComponentModels/FluxStdSrcs.cc @@ -124,7 +124,7 @@ FluxStdSrcs::Source FluxStdSrcs::srcNameToEnum(const String& srcName, const MDir os << LogIO::NORMAL << "Trying to determine source match by position..." << LogIO::POST; - Table tmpsubtab = tableCommand(taql); + Table tmpsubtab = tableCommand(taql).table(); if(tmpsubtab.nrow()) { ScalarColumn srcNameCol(tmpsubtab,"Name"); String srcNameInTable = srcNameCol.getColumnCells(RefRows(0,0))[0]; diff --git a/components/SpectralComponents/ProfileFit1D.tcc b/components/SpectralComponents/ProfileFit1D.tcc index f0039d8..081b8fc 100644 --- a/components/SpectralComponents/ProfileFit1D.tcc +++ b/components/SpectralComponents/ProfileFit1D.tcc @@ -442,8 +442,7 @@ void ProfileFit1D::copy(const ProfileFit1D& other) template void ProfileFit1D::checkType() const { - T* p=0; - AlwaysAssert(whatType(p)==TpDouble,AipsError); + AlwaysAssert(whatType()==TpDouble,AipsError); } } //#End casa namespace diff --git a/msvis/MSVis/MSContinuumSubtractor.cc b/msvis/MSVis/MSContinuumSubtractor.cc index 134004a..4e47857 100644 --- a/msvis/MSVis/MSContinuumSubtractor.cc +++ b/msvis/MSVis/MSContinuumSubtractor.cc @@ -245,7 +245,7 @@ void MSContinuumSubtractor::subtract() } //os <<"Selection string: "< > outImage1; + std::unique_ptr > outImage1; outHighRes= highRes+"_stokes"; ImageUtilities::addDegenerateAxes (os, outImage1, hightemp, outHighRes, False, False, "I", False, False, False); - PtrHolder > outImage2; + std::unique_ptr > outImage2; outLowRes= lowRes+"_stokes"; ImageUtilities::addDegenerateAxes (os, outImage2, lowtemp, outLowRes, False, False, @@ -2887,7 +2888,7 @@ Bool Imager::uvrange(const Double& uvmin, const Double& uvmax) spwsel << "]"; MSSpectralWindow msspw(tableCommand(spwsel.str(), - mssel_p->spectralWindow())); + mssel_p->spectralWindow()).table()); ROMSSpWindowColumns spwc(msspw); // This averaging scheme will work even if the spectral windows are @@ -2928,7 +2929,7 @@ Bool Imager::uvrange(const Double& uvmin, const Double& uvmax) // Apply the TAQL selection string, to remake the selected MS String parseString="select from $1 where (SQUARE(UVW[1]) + SQUARE(UVW[2]))*" + strInvLambda + " > " + String(strUVmin) + " && (SQUARE(UVW[1]) + SQUARE(UVW[2]))*" + strInvLambda + " < " + String(strUVmax) ; - mssel_p2=new MeasurementSet(tableCommand(parseString,*mssel_p)); + mssel_p2=new MeasurementSet(tableCommand(parseString,*mssel_p).table()); AlwaysAssert(mssel_p2, AipsError); // Rename the selected MS as */SELECTED_UVRANGE //mssel_p2->rename(msname_p+"/SELECTED_UVRANGE", Table::Scratch); diff --git a/synthesis/MeasurementEquations/MatrixCleaner.cc b/synthesis/MeasurementEquations/MatrixCleaner.cc index 45b67aa..ae9925d 100644 --- a/synthesis/MeasurementEquations/MatrixCleaner.cc +++ b/synthesis/MeasurementEquations/MatrixCleaner.cc @@ -140,7 +140,7 @@ MatrixCleaner::MatrixCleaner(const Matrix & psf, // So, we pass it in itsMemoryMB=Double(HostInfo::memoryTotal()/1024)/16.0; - itsDirty = new Matrix(dirty.shape()); + itsDirty.reset(new Matrix(dirty.shape())); itsDirty->assign(dirty); setPsf(psf); itsScales.resize(0); @@ -155,7 +155,7 @@ MatrixCleaner::MatrixCleaner(const Matrix & psf, void MatrixCleaner::setPsf(const Matrix& psf){ - itsXfr=new Matrix(); + itsXfr.reset(new Matrix()); AlwaysAssert(validatePsf(psf), AipsError); psfShape_p.resize(0, False); psfShape_p=psf.shape(); @@ -201,13 +201,13 @@ MatrixCleaner & MatrixCleaner::operator=(const MatrixCleaner & other) { MatrixCleaner::~MatrixCleaner() { destroyScales(); - if(!itsMask.null()) itsMask=0; + itsMask.reset(); } void MatrixCleaner::makeDirtyScales(){ - if(!itsScalesValid || itsNscales < 1 || itsDirty.null() || (itsNscales != Int(itsScaleXfrs.nelements())) ) + if(!itsScalesValid || itsNscales < 1 || !itsDirty || (itsNscales != Int(itsScaleXfrs.nelements())) ) return; if( (psfShape_p) != (itsDirty->shape())) @@ -257,7 +257,7 @@ void MatrixCleaner::setMask(Matrix & mask, const Float& maskThreshold) //cerr << "Mask Shape " << mask.shape() << endl; // This is not needed after the first steps - itsMask = new Matrix(mask.shape()); + itsMask.reset(new Matrix(mask.shape())); itsMask->assign(mask); if(max(*itsMask) < itsMaskThreshold) noClean_p=True; @@ -371,7 +371,7 @@ Int MatrixCleaner::clean(Matrix& model, IPosition blcDirty(model.shape().nelements(), 0); IPosition trcDirty(model.shape()-1); - if(!itsMask.null()){ + if(itsMask){ os << "Cleaning using given mask" << LogIO::POST; if (itsMaskThreshold<0) { os << LogIO::NORMAL @@ -443,7 +443,7 @@ Int MatrixCleaner::clean(Matrix& model, LCBox centerBox(blcDirty, trcDirty, model.shape()); Block > scaleMaskSubs; - if (!itsMask.null()) { + if (itsMask) { scaleMaskSubs.resize(itsNscales); for (Int is=0; is < itsNscales; is++) { scaleMaskSubs[is] = ((itsScaleMasks[is]))(blcDirty, trcDirty); @@ -479,7 +479,7 @@ Int MatrixCleaner::clean(Matrix& model, posMaximum[scale]=IPosition(model.shape().nelements(), 0); - if (!itsMask.null()) { + if (itsMask) { findMaxAbsMask(dirtySub, (scaleMaskSubs[scale]), maxima(scale), posMaximum[scale]); } else { @@ -745,7 +745,7 @@ Bool MatrixCleaner::setscales(const Int nscales, const Float scaleInc) void MatrixCleaner::setDirty(const Matrix& dirty){ - itsDirty=new Matrix(dirty.shape()); + itsDirty.reset(new Matrix(dirty.shape())); itsDirty->assign(dirty); @@ -772,7 +772,7 @@ void MatrixCleaner::makePsfScales(){ LogIO os(LogOrigin("MatrixCleaner", "mkePsfScales()", WHERE)); if(itsNscales < 1) throw(AipsError("Scales have to be set")); - if(itsXfr.null()) + if(!itsXfr) throw(AipsError("Psf is not defined")); destroyScales(); itsScales.resize(itsNscales, True); @@ -851,7 +851,7 @@ Bool MatrixCleaner::setscales(const Vector& scaleSizes) itsPsfConvScales[scale].resize(); } - AlwaysAssert(!itsDirty.null(), AipsError); + AlwaysAssert(static_cast(itsDirty), AipsError); FFTServer fft(itsDirty->shape()); @@ -925,7 +925,7 @@ Bool MatrixCleaner::setscales(const Vector& scaleSizes) itsScalesValid=True; - if (!itsMask.null()) { + if (itsMask) { makeScaleMasks(); } @@ -1093,8 +1093,7 @@ Bool MatrixCleaner::destroyMasks() void MatrixCleaner::unsetMask() { destroyMasks(); - if(!itsMask.null()) - itsMask=0; + itsMask.reset(); noClean_p=False; } @@ -1119,7 +1118,7 @@ Bool MatrixCleaner::makeScaleMasks() destroyMasks(); - if(itsMask.null() || noClean_p) + if(!itsMask || noClean_p) return False; AlwaysAssert((itsMask->shape() == psfShape_p), AipsError); diff --git a/synthesis/MeasurementEquations/MatrixCleaner.h b/synthesis/MeasurementEquations/MatrixCleaner.h index fd91c45..6c04d24 100644 --- a/synthesis/MeasurementEquations/MatrixCleaner.h +++ b/synthesis/MeasurementEquations/MatrixCleaner.h @@ -39,6 +39,8 @@ #include #include +#include + namespace casacore { //# NAMESPACE CASACORE - BEGIN // A copy of LatticeCleaner but just using 2-D matrices @@ -273,7 +275,7 @@ class MatrixCleaner Float itsGain; Int itsMaxNiter; // maximum possible number of iterations Quantum itsThreshold; - CountedPtr > itsMask; + std::shared_ptr > itsMask; IPosition itsPositionPeakPsf; Float itsSmallScaleBias; Block > itsScaleMasks; @@ -290,8 +292,8 @@ class MatrixCleaner //# because all information must be supplied in the input arguments - CountedPtr > itsDirty; - CountedPtr >itsXfr; + std::shared_ptr > itsDirty; + std::shared_ptr >itsXfr; Vector itsScaleSizes; diff --git a/synthesis/MeasurementEquations/MultiTermMatrixCleaner.cc b/synthesis/MeasurementEquations/MultiTermMatrixCleaner.cc index 9438de4..791b9c1 100644 --- a/synthesis/MeasurementEquations/MultiTermMatrixCleaner.cc +++ b/synthesis/MeasurementEquations/MultiTermMatrixCleaner.cc @@ -200,8 +200,8 @@ Bool MultiTermMatrixCleaner::setmodel(int order, Matrix & model) Bool MultiTermMatrixCleaner::setmask(Matrix & mask) { - if(itsMask.null()) - itsMask = new Matrix(mask); // it's a counted ptr + if(!itsMask) + itsMask.reset(new Matrix(mask)); // it's a counted ptr else { AlwaysAssert(itsMask->shape()==mask.shape(), AipsError); @@ -533,7 +533,7 @@ Int MultiTermMatrixCleaner::allocateMemory() /* At the end, force a scale-dependent border */ Int MultiTermMatrixCleaner::setupUserMask() { - if(itsMask.null()) + if(!itsMask) { /* Make a mask the full size, for all scales */ for(Int scale=0;scale Date: Thu, 16 Jan 2025 15:24:35 +1100 Subject: [PATCH 3/7] polished cmake file to address warnings, removed old C++ standard restriction, replaced PtrHolder with std::unique_ptr --- CMakeLists.txt | 20 ++--------- cmake/FindCasaCore.cmake | 4 +-- .../SpectralElementFactory.cc | 35 ++++++++++--------- .../SpectralComponents/SpectralFit2.tcc | 17 +++++---- components/SpectralComponents/SpectralList.cc | 5 +-- .../test/tGaussianMultipletSpectralElement.cc | 9 ++--- ...LogTransformedPolynomialSpectralElement.cc | 7 ++-- .../test/tLorentzianSpectralElement.cc | 6 ++-- .../tPowerLogPolynomialSpectralElement.cc | 6 ++-- simulators/Simulators/SimArray.h | 1 - synthesis/MeasurementComponents/CExp.h | 6 ++-- synthesis/MeasurementComponents/CExp.new3.h | 2 +- 12 files changed, 52 insertions(+), 66 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e3a9b5..ac05ef3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ project(casarest) enable_language(CXX Fortran) -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 3.3.0) include(CheckCXXCompilerFlag) #list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake) set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") @@ -21,25 +21,9 @@ if(HDF5_ROOT_DIR) set(ENV{HDF5_ROOT} ${HDF5_ROOT_DIR}) endif(HDF5_ROOT_DIR) -# Detect if the compiler supports C++11 if we want to use it. -check_cxx_compiler_flag(-std=c++11 HAS_CXX11) -if (HAS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -else() - message(FATAL_ERROR "Casacore build requires a c++11 compatible compiler") -endif (HAS_CXX11) - -# libsynthesis has a mix of C++ and Fortran which is not handled well by -# versions before 2.8. -if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8) - if(NOT LIB_EXTRA_SYNTHESIS) - set(LIB_EXTRA_SYNTHESIS gfortran) - endif(NOT LIB_EXTRA_SYNTHESIS) -endif(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8) - # project version set( ${PROJECT_NAME}_MAJOR_VERSION 1 ) -set( ${PROJECT_NAME}_MINOR_VERSION 8 ) +set( ${PROJECT_NAME}_MINOR_VERSION 9 ) set( ${PROJECT_NAME}_PATCH_LEVEL 0 ) if (UseCasaNamespace) diff --git a/cmake/FindCasaCore.cmake b/cmake/FindCasaCore.cmake index 197b075..01ca7a4 100644 --- a/cmake/FindCasaCore.cmake +++ b/cmake/FindCasaCore.cmake @@ -212,9 +212,9 @@ else(NOT CASACORE_INCLUDE_DIR) casacore_find_library(m) list(APPEND CASACORE_LIBRARIES ${CMAKE_DL_LIBS}) elseif(${_comp} STREQUAL coordinates) - casacore_find_package(WcsLib REQUIRED) + casacore_find_package(WCSLIB REQUIRED) elseif(${_comp} STREQUAL fits) - casacore_find_package(CfitsIO REQUIRED) + casacore_find_package(CFITSIO REQUIRED) elseif(${_comp} STREQUAL scimath_f) casacore_find_package(LAPACK REQUIRED) endif(${_comp} STREQUAL casa) diff --git a/components/SpectralComponents/SpectralElementFactory.cc b/components/SpectralComponents/SpectralElementFactory.cc index 3ec6cb7..4f103ae 100644 --- a/components/SpectralComponents/SpectralElementFactory.cc +++ b/components/SpectralComponents/SpectralElementFactory.cc @@ -28,7 +28,6 @@ //# Includes #include -#include #include #include #include @@ -38,12 +37,14 @@ #include #include +#include + namespace casacore { //# NAMESPACE CASACORE - BEGIN SpectralElement* SpectralElementFactory::fromRecord( const RecordInterface &in ) { - PtrHolder specEl; + std::unique_ptr specEl; String origin = "SpectralElementFactory::fromRecord: "; if ( ! in.isDefined("type") @@ -141,7 +142,7 @@ SpectralElement* SpectralElementFactory::fromRecord( } param(2) = GaussianSpectralElement::sigmaFromFWHM (param(2)); errs(2) = GaussianSpectralElement::sigmaFromFWHM (errs(2)); - specEl.set(new GaussianSpectralElement(param(0), param(1), param(2))); + specEl.reset(new GaussianSpectralElement(param(0), param(1), param(2))); specEl->setError(errs); break; case SpectralElement::LORENTZIAN: @@ -155,9 +156,9 @@ SpectralElement* SpectralElementFactory::fromRecord( "The width of a Lorentzian element must be positive" ); } - specEl.set(new LorentzianSpectralElement(param(0), param(1), param(2))); - specEl->setError(errs); - break; + specEl.reset(new LorentzianSpectralElement(param(0), param(1), param(2))); + specEl->setError(errs); + break; case SpectralElement::POLYNOMIAL: if (param.nelements() == 0) { throw AipsError( @@ -165,7 +166,7 @@ SpectralElement* SpectralElementFactory::fromRecord( "of at least zero" ); } - specEl.set(new PolynomialSpectralElement(param.nelements() - 1)); + specEl.reset(new PolynomialSpectralElement(param.nelements() - 1)); specEl->set(param); specEl->setError(errs); break; @@ -176,7 +177,7 @@ SpectralElement* SpectralElementFactory::fromRecord( ) { String function; in.get(RecordFieldId("compiled"), function); - specEl.set(new CompiledSpectralElement(function, param)); + specEl.reset(new CompiledSpectralElement(function, param)); specEl->setError(errs); } else { @@ -200,10 +201,11 @@ SpectralElement* SpectralElementFactory::fromRecord( while(True) { String id = "*" + String::toString(i); if (gaussians.isDefined(id)) { - PtrHolder gauss(fromRecord(gaussians.asRecord(id))); + // MV: I found this code rather untidy w.r.t. pointer management, but leave it as is for now + std::unique_ptr gauss(fromRecord(gaussians.asRecord(id))); comps.push_back( *dynamic_cast( - gauss.ptr() + gauss.get() ) ); i++; @@ -214,20 +216,20 @@ SpectralElement* SpectralElementFactory::fromRecord( } Matrix fixedMatrix = in.asArrayDouble("fixedMatrix"); fixedMatrix.reform(IPosition(2, comps.size()-1, 3)); - specEl.set(new GaussianMultipletSpectralElement(comps, fixedMatrix)); + specEl.reset(new GaussianMultipletSpectralElement(comps, fixedMatrix)); } break; case SpectralElement::POWERLOGPOLY: { - specEl.set(new PowerLogPolynomialSpectralElement(param)); + specEl.reset(new PowerLogPolynomialSpectralElement(param)); specEl->set(param); specEl->setError(errs); } break; case SpectralElement::LOGTRANSPOLY: { - specEl.set(new LogTransformedPolynomialSpectralElement(param)); - specEl->set(param); + specEl.reset(new LogTransformedPolynomialSpectralElement(param)); + specEl->set(param); specEl->setError(errs); } break; @@ -243,9 +245,8 @@ SpectralElement* SpectralElementFactory::fromRecord( specEl->fix(in.asArrayBool("fixed")); } // ready to return, fish out the pointer and return it without deleting it - SpectralElement *sp = specEl.ptr(); - specEl.clear(False); - return sp; + SpectralElement *sp = specEl.release(); + return sp; } diff --git a/components/SpectralComponents/SpectralFit2.tcc b/components/SpectralComponents/SpectralFit2.tcc index 7c086c5..09f096d 100644 --- a/components/SpectralComponents/SpectralFit2.tcc +++ b/components/SpectralComponents/SpectralFit2.tcc @@ -28,7 +28,6 @@ //# Includes #include -#include #include #include #include @@ -67,38 +66,38 @@ Bool SpectralFit::fit( // The functions to fit CompoundFunction > func; uInt ncomps = slist_p.nelements(); - PtrHolder > > autodiff; + std::unique_ptr > > autodiff; for (uInt i=0; igetOrder(); SpectralElement::Types type = slist_p[i]->getType(); switch(type) { case SpectralElement::GAUSSIAN: { - autodiff.set(new Gaussian1D >()); + autodiff.reset(new Gaussian1D >()); } break; case SpectralElement::POLYNOMIAL: { PolynomialSpectralElement *x = dynamic_cast(elem); - autodiff.set(new Polynomial >(x->getDegree())); + autodiff.reset(new Polynomial >(x->getDegree())); } break; case SpectralElement::COMPILED: // Allow fall through; these use the same code case SpectralElement::GMULTIPLET: { CompiledSpectralElement *x = dynamic_cast(elem); - autodiff.set(new CompiledFunction >()); + autodiff.reset(new CompiledFunction >()); dynamic_cast > *>( - autodiff.ptr() + autodiff.get() )->setFunction(x->getFunction()); } break; case SpectralElement::LORENTZIAN: { - autodiff.set(new Lorentzian1D >()); + autodiff.reset(new Lorentzian1D >()); } break; case SpectralElement::POWERLOGPOLY: { Vector parms = elem->get(); - autodiff.set(new PowerLogarithmicPolynomial > (nparms)); + autodiff.reset(new PowerLogarithmicPolynomial > (nparms)); } break; case SpectralElement::LOGTRANSPOLY: { @@ -107,7 +106,7 @@ Bool SpectralFit::fit( >(elem); // treated as a polynomial for fitting purposes. The caller is responsible for passing the ln's of // the ordinate and obscissa values to the fitter. - autodiff.set(new Polynomial > (x->getDegree())); + autodiff.reset(new Polynomial > (x->getDegree())); } break; default: diff --git a/components/SpectralComponents/SpectralList.cc b/components/SpectralComponents/SpectralList.cc index 1aa3890..02e8414 100644 --- a/components/SpectralComponents/SpectralList.cc +++ b/components/SpectralComponents/SpectralList.cc @@ -32,11 +32,12 @@ #include #include #include -#include #include #include +#include + namespace casacore { //# NAMESPACE CASACORE - BEGIN //# Constructors @@ -179,7 +180,7 @@ Bool SpectralList::fromRecord (String& errMsg, const RecordInterface& container) for (uInt i=0; i specEl(SpectralElementFactory::fromRecord(rec)); + std::unique_ptr specEl(SpectralElementFactory::fromRecord(rec)); add(*specEl); } else { errMsg = String("Illegal record structure"); diff --git a/components/SpectralComponents/test/tGaussianMultipletSpectralElement.cc b/components/SpectralComponents/test/tGaussianMultipletSpectralElement.cc index 0054935..4b80b5a 100644 --- a/components/SpectralComponents/test/tGaussianMultipletSpectralElement.cc +++ b/components/SpectralComponents/test/tGaussianMultipletSpectralElement.cc @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -44,6 +43,7 @@ #include #include +#include int main() { @@ -213,10 +213,11 @@ int main() { doublet.toRecord(myRec); cout << "myrec " << myRec << endl; cout << __FILE__ << " " << __LINE__ << endl; - PtrHolder ptr(SpectralElementFactory::fromRecord(myRec)); + std::unique_ptr ptr(SpectralElementFactory::fromRecord(myRec)); + AlwaysAssert(static_cast(ptr), AipsError); cout << __FILE__ << " " << __LINE__ << endl; - GaussianMultipletSpectralElement out = *dynamic_cast( - ptr.ptr() + GaussianMultipletSpectralElement& out = dynamic_cast( + *ptr ); cout << __FILE__ << " " << __LINE__ << endl; cout << "out " << out << endl; diff --git a/components/SpectralComponents/test/tLogTransformedPolynomialSpectralElement.cc b/components/SpectralComponents/test/tLogTransformedPolynomialSpectralElement.cc index ca05340..f9a5126 100644 --- a/components/SpectralComponents/test/tLogTransformedPolynomialSpectralElement.cc +++ b/components/SpectralComponents/test/tLogTransformedPolynomialSpectralElement.cc @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -41,6 +40,8 @@ #include +#include + int main() { { try { @@ -58,8 +59,8 @@ int main() { cout << "Test to/from record" << endl; Record rec; ltp.toRecord(rec); - PtrHolder el(SpectralElementFactory::fromRecord(rec)); - LogTransformedPolynomialSpectralElement ltp2 = *dynamic_cast(el.ptr()); + std::unique_ptr el(SpectralElementFactory::fromRecord(rec)); + LogTransformedPolynomialSpectralElement ltp2 = *dynamic_cast(el.get()); AlwaysAssert(ltp == ltp2, AipsError); } catch (const AipsError& x) { diff --git a/components/SpectralComponents/test/tLorentzianSpectralElement.cc b/components/SpectralComponents/test/tLorentzianSpectralElement.cc index 9e41340..1631de5 100644 --- a/components/SpectralComponents/test/tLorentzianSpectralElement.cc +++ b/components/SpectralComponents/test/tLorentzianSpectralElement.cc @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -40,6 +39,7 @@ #include +#include int main() { { @@ -54,8 +54,8 @@ int main() { cout << "Test to/from record" << endl; Record rec; lse.toRecord(rec); - PtrHolder el(SpectralElementFactory::fromRecord(rec)); - lse = *dynamic_cast(el.ptr()); + std::unique_ptr el(SpectralElementFactory::fromRecord(rec)); + lse = *dynamic_cast(el.get()); AlwaysAssert(lse.getAmpl() == amp, AipsError); AlwaysAssert(lse.getCenter() == center, AipsError); AlwaysAssert(lse.getFWHM() == fwhm, AipsError); diff --git a/components/SpectralComponents/test/tPowerLogPolynomialSpectralElement.cc b/components/SpectralComponents/test/tPowerLogPolynomialSpectralElement.cc index b8e1f8e..9b6be15 100644 --- a/components/SpectralComponents/test/tPowerLogPolynomialSpectralElement.cc +++ b/components/SpectralComponents/test/tPowerLogPolynomialSpectralElement.cc @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -41,6 +40,7 @@ #include +#include int main() { { @@ -58,8 +58,8 @@ int main() { cout << "Test to/from record" << endl; Record rec; plp.toRecord(rec); - PtrHolder el(SpectralElementFactory::fromRecord(rec)); - plp = *dynamic_cast(el.ptr()); + std::unique_ptr el(SpectralElementFactory::fromRecord(rec)); + plp = *dynamic_cast(el.get()); AlwaysAssert(allTrue(plp.get() == p), AipsError); } catch (const AipsError& x) { diff --git a/simulators/Simulators/SimArray.h b/simulators/Simulators/SimArray.h index c5416e6..1c1fa9b 100644 --- a/simulators/Simulators/SimArray.h +++ b/simulators/Simulators/SimArray.h @@ -28,7 +28,6 @@ #ifndef SIMULATORS_SIMARRAY_H #define SIMULATORS_SIMARRAY_H -#include #include #include #include diff --git a/synthesis/MeasurementComponents/CExp.h b/synthesis/MeasurementComponents/CExp.h index 484b23e..9dfd795 100644 --- a/synthesis/MeasurementComponents/CExp.h +++ b/synthesis/MeasurementComponents/CExp.h @@ -42,7 +42,7 @@ namespace casacore{ #define HASH(A) {(int)(myhash((A)/PI2)/Step)} #define MYHASH(A) {((int)((((A)<0)?(((A)+1-(int)(A))*PI2):(((A)-(int)(A))*PI2))/Step))} -inline double myhash(register double arg) +inline double myhash(double arg) { if (arg < 0) return (arg+1-(int)arg)*PI2; return (arg-(int)arg)*PI2; @@ -73,7 +73,7 @@ template class CExp } } - inline double f(register T arg) + inline double f(T arg) { if (arg < 0) return (arg+1-(int)arg)*PI2; return (arg-(int)arg)*PI2; @@ -82,7 +82,7 @@ template class CExp inline int hashFunction(T arg) {return (int)(std::fmod(abs(arg+PI2),PI2)/Step);} //{return (int)(myhash(arg/PI2)/Step);} - inline int myhash2(register double arg) + inline int myhash2(double arg) { /* Steps must be double here, otherwise compiler will keep converting from int to double everytime, because Steps is a variable. */ diff --git a/synthesis/MeasurementComponents/CExp.new3.h b/synthesis/MeasurementComponents/CExp.new3.h index b3e7b18..a02aac0 100644 --- a/synthesis/MeasurementComponents/CExp.new3.h +++ b/synthesis/MeasurementComponents/CExp.new3.h @@ -59,7 +59,7 @@ template class CExp3 RTable[i] = cos(i*Step); } } - inline int f(register T arg) + inline int f(T arg) { return (int)((arg<0)?((arg+1-(int)arg)*Size):((arg-(int)arg)*Size)); // if (arg < 0) return (int)((arg+1-(int)arg)*Size); return (int)((arg-(int)arg)*Size); From aaff63d2c77c3df773b243e9f5583872a4b33d93 Mon Sep 17 00:00:00 2001 From: Max Voronkov Date: Wed, 5 Feb 2025 11:55:15 +1100 Subject: [PATCH 4/7] changed starting image to ubuntu-25.04 (which should have casacore-3.6.1) in an attempt to fix the CI --- docker/clang.docker | 2 +- docker/gcc.docker | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/clang.docker b/docker/clang.docker index b8fc769..7454098 100644 --- a/docker/clang.docker +++ b/docker/clang.docker @@ -1,4 +1,4 @@ -FROM kernsuite/base:7 +FROM ubuntu:25.04 RUN docker-apt-install \ build-essential \ clang \ diff --git a/docker/gcc.docker b/docker/gcc.docker index 098a310..f556f3d 100644 --- a/docker/gcc.docker +++ b/docker/gcc.docker @@ -1,4 +1,4 @@ -FROM kernsuite/base:7 +FROM ubuntu:25.04 RUN docker-apt-install \ build-essential \ From 7873284855b218af1c1c880abce0bde5b6e070eb Mon Sep 17 00:00:00 2001 From: Max Voronkov Date: Thu, 13 Mar 2025 14:37:35 +1100 Subject: [PATCH 5/7] changed docker recipe to build casacore-3.6.1 from source in an attempt to fix CI --- docker/clang.docker | 65 ++++++++++++++++++++++++++++++++------------- docker/gcc.docker | 59 +++++++++++++++++++++++++++++----------- 2 files changed, 90 insertions(+), 34 deletions(-) diff --git a/docker/clang.docker b/docker/clang.docker index 7454098..253f51c 100644 --- a/docker/clang.docker +++ b/docker/clang.docker @@ -1,32 +1,61 @@ -FROM ubuntu:25.04 -RUN docker-apt-install \ - build-essential \ - clang \ +FROM ubuntu:22.04 +RUN export DEBIAN_FRONTEND=noninteractive \ + && apt-get update \ + && apt-get install -y \ + gcc \ + g++ \ cmake \ - casacore-dev \ - libhdf5-dev \ - libboost-all-dev \ - wcslib-dev \ - libcfitsio-dev \ - libboost-system-dev \ - libboost-thread-dev \ + flex \ + bison \ libblas-dev \ liblapack-dev \ + libcfitsio-dev \ + wcslib-dev \ + libfftw3-dev \ + gfortran \ libncurses5-dev \ - libmysofa-dev \ - bison \ - libbison-dev \ - flex \ libreadline6-dev \ - gfortran + libhdf5-serial-dev \ + libboost-dev \ + libboost-python-dev \ + libboost-test-dev \ + libgsl-dev \ + python-is-python3 \ + python3-numpy \ + wget \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ +# Install WSRT Measures (extra casacore data, for tests) +# Note: The file on the ftp site is updated daily. When warnings regarding leap +# seconds appear, ignore them or regenerate the docker image. + && wget -nv -O /WSRT_Measures.ztar ftp://ftp.astron.nl/outgoing/Measures/WSRT_Measures.ztar \ + && mkdir -p /usr/local/share/casacore/data \ + && cd /usr/local/share/casacore/data \ + && tar xfz /WSRT_Measures.ztar \ + && rm /WSRT_Measures.ztar ADD . /code RUN mkdir /code/build -WORKDIR /code/build + +# build the required version of casacore from source +WORKDIR /usr/local/share/casacore/ +RUN wget https://github.com/casacore/casacore/archive/v3.6.1.tar.gz +RUN tar -xvf v3.6.1.tar.gz +WORKDIR /usr/local/share/casacore/casacore-3.6.1 +RUN mkdir build +WORKDIR build RUN cmake .. \ - -DBUILD_TESTING=ON \ -DCMAKE_C_COMPILER=/usr/bin/clang \ -DCMAKE_CXX_COMPILER=/usr/bin/clang++ +RUN make -j4 +RUN make install + +# now build and test casarest + +WORKDIR /code/build +RUN cmake .. -DBUILD_TESTING=ON \ + -DCMAKE_C_COMPILER=/usr/bin/clang \ + -DCMAKE_CXX_COMPILER=/usr/bin/clang++ + RUN make -j 4 RUN make test RUN make install diff --git a/docker/gcc.docker b/docker/gcc.docker index f556f3d..f888f4d 100644 --- a/docker/gcc.docker +++ b/docker/gcc.docker @@ -1,27 +1,54 @@ -FROM ubuntu:25.04 - -RUN docker-apt-install \ - build-essential \ +FROM ubuntu:22.04 +RUN export DEBIAN_FRONTEND=noninteractive \ + && apt-get update \ + && apt-get install -y \ + gcc \ + g++ \ cmake \ - casacore-dev \ - libhdf5-dev \ - libboost-all-dev \ - wcslib-dev \ - libcfitsio-dev \ - libboost-system-dev \ - libboost-thread-dev \ + flex \ + bison \ libblas-dev \ liblapack-dev \ + libcfitsio-dev \ + wcslib-dev \ + libfftw3-dev \ + gfortran \ libncurses5-dev \ - libmysofa-dev \ - bison \ - libbison-dev \ - flex \ libreadline6-dev \ - gfortran + libhdf5-serial-dev \ + libboost-dev \ + libboost-python-dev \ + libboost-test-dev \ + libgsl-dev \ + python-is-python3 \ + python3-numpy \ + wget \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ +# Install WSRT Measures (extra casacore data, for tests) +# Note: The file on the ftp site is updated daily. When warnings regarding leap +# seconds appear, ignore them or regenerate the docker image. + && wget -nv -O /WSRT_Measures.ztar ftp://ftp.astron.nl/outgoing/Measures/WSRT_Measures.ztar \ + && mkdir -p /usr/local/share/casacore/data \ + && cd /usr/local/share/casacore/data \ + && tar xfz /WSRT_Measures.ztar \ + && rm /WSRT_Measures.ztar ADD . /code RUN mkdir /code/build + +# build the required version of casacore from source +WORKDIR /usr/local/share/casacore/ +RUN wget https://github.com/casacore/casacore/archive/v3.6.1.tar.gz +RUN tar -xvf v3.6.1.tar.gz +WORKDIR /usr/local/share/casacore/casacore-3.6.1 +RUN mkdir build +WORKDIR build +RUN cmake .. +RUN make -j4 +RUN make install + +# now build and test casarest + WORKDIR /code/build RUN cmake .. -DBUILD_TESTING=ON RUN make -j 4 From 343e3a4798e6ef116d5edebf615cbc84ab870daa Mon Sep 17 00:00:00 2001 From: Max Voronkov Date: Thu, 13 Mar 2025 14:48:40 +1100 Subject: [PATCH 6/7] patched docker files by adding clang and alter cmake config for casacore - still trying to fix CI --- docker/clang.docker | 4 ++++ docker/gcc.docker | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docker/clang.docker b/docker/clang.docker index 253f51c..1265662 100644 --- a/docker/clang.docker +++ b/docker/clang.docker @@ -4,6 +4,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \ && apt-get install -y \ gcc \ g++ \ + clang \ cmake \ flex \ bison \ @@ -44,6 +45,9 @@ WORKDIR /usr/local/share/casacore/casacore-3.6.1 RUN mkdir build WORKDIR build RUN cmake .. \ + -DUSE_OPENMP=OFF \ + -DUSE_HDF5=ON \ + -DDATA_DIR=/usr/local/share/casacore/data \ -DCMAKE_C_COMPILER=/usr/bin/clang \ -DCMAKE_CXX_COMPILER=/usr/bin/clang++ RUN make -j4 diff --git a/docker/gcc.docker b/docker/gcc.docker index f888f4d..781fa17 100644 --- a/docker/gcc.docker +++ b/docker/gcc.docker @@ -43,7 +43,10 @@ RUN tar -xvf v3.6.1.tar.gz WORKDIR /usr/local/share/casacore/casacore-3.6.1 RUN mkdir build WORKDIR build -RUN cmake .. +RUN cmake .. \ + -DUSE_OPENMP=OFF \ + -DUSE_HDF5=ON \ + -DDATA_DIR=/usr/local/share/casacore/data RUN make -j4 RUN make install From a7f30ef36e805e2d5865f764f62551c150401225 Mon Sep 17 00:00:00 2001 From: Max Voronkov Date: Thu, 13 Mar 2025 15:13:57 +1100 Subject: [PATCH 7/7] added missing libraries from the original docker files, still trying to sort out CI --- docker/clang.docker | 5 +++++ docker/gcc.docker | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/docker/clang.docker b/docker/clang.docker index 1265662..8042e58 100644 --- a/docker/clang.docker +++ b/docker/clang.docker @@ -8,6 +8,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \ cmake \ flex \ bison \ + libbison-dev \ libblas-dev \ liblapack-dev \ libcfitsio-dev \ @@ -16,10 +17,14 @@ RUN export DEBIAN_FRONTEND=noninteractive \ gfortran \ libncurses5-dev \ libreadline6-dev \ + libhdf5-dev \ libhdf5-serial-dev \ + libboost-system-dev \ + libboost-thread-dev \ libboost-dev \ libboost-python-dev \ libboost-test-dev \ + libmysofa-dev \ libgsl-dev \ python-is-python3 \ python3-numpy \ diff --git a/docker/gcc.docker b/docker/gcc.docker index 781fa17..c5442bb 100644 --- a/docker/gcc.docker +++ b/docker/gcc.docker @@ -7,6 +7,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \ cmake \ flex \ bison \ + libbison-dev \ libblas-dev \ liblapack-dev \ libcfitsio-dev \ @@ -15,10 +16,14 @@ RUN export DEBIAN_FRONTEND=noninteractive \ gfortran \ libncurses5-dev \ libreadline6-dev \ + libhdf5-dev \ libhdf5-serial-dev \ + libboost-system-dev \ + libboost-thread-dev \ libboost-dev \ libboost-python-dev \ libboost-test-dev \ + libmysofa-dev \ libgsl-dev \ python-is-python3 \ python3-numpy \