Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
49 changes: 32 additions & 17 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,25 @@ jobs:
config: Release
arch: "64"
compiler: msvc
experimental: true
- os: windows
os_ver: "2022"
config: Release
arch: "64"
compiler: clang
experimental: true
experimental: false
# - os: windows
# os_ver: "2022"
# config: Release
# arch: "64"
# compiler: clang
# experimental: true
- os: macos
os_ver: "11"
os_ver: "12"
config: Release
arch: "64"
compiler: clang
experimental: true
- os: ubuntu
os_ver: "22.04"
config: Release
arch: "64"
compiler: gcc
experimental: true
experimental: false
# - os: ubuntu
# os_ver: "22.04"
# config: Release
# arch: "64"
# compiler: gcc
# experimental: true
defaults:
run:
shell: bash
Expand All @@ -50,6 +50,9 @@ jobs:
with:
fetch-depth: 0
submodules: recursive
- name: Get number of CPU cores # Can replace when CMake is upgraded to 3.29
uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores
- name: Build CSE
uses: ./.github/actions/build-cse
with:
Expand All @@ -62,16 +65,28 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: CSE_${{ matrix.os }}-${{ matrix.os_ver }}-${{ matrix.arch }}bit_${{ matrix.config }}
path: build/CSE*
path: |
build/CSE*
build/cse*
- name: Build wcmp executable
run: cmake -DBUILD_ARCHITECTURE=${{ matrix.arch }} -DCONFIGURATION=${{ matrix.config }} -DTARGET_NAME=wcmp -DBUILD_DIRECTORY=build -P cmake/build.cmake
# - name: Setup Mesa3D
# uses: bigladder/github-actions/setup-mesa3d@main
# with:
# install-directory: msvc
- name: Test
run: ctest -C ${{ matrix.config }} -j 2 --output-on-failure -E shadetest # CI can't do GPU calcs at this time (the steps above get us close, but throws an exception on destruction)
id: test
run: ctest -C ${{ matrix.config }} -j ${{ steps.cpu-cores.outputs.count }} --output-on-failure -E shadetest # CI can't do GPU calcs at this time (the steps above get us close, but throws an exception on destruction)
working-directory: build
continue-on-error: false
- name: Upload report files artifact
if: steps.test.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: Reports-${{ matrix.os }}-${{ matrix.os_ver }}-${{ matrix.arch }}bit_${{ matrix.config }}
path: |
test/*.rep
test/*.REP
build-doc:
strategy:
fail-fast: false
Expand Down
10 changes: 9 additions & 1 deletion cmake/build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,19 @@ if (NOT DEFINED BUILD_DIRECTORY)
set(BUILD_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/builds/${BUILD_CONFIGURATION}")
endif ()

include(ProcessorCount)
ProcessorCount(N)
if(NOT N EQUAL 0)
set(parallel_jobs ${N})
else()
set(parallel_jobs 1)
endif()

execute_process(COMMAND ${CMAKE_COMMAND}
--build .
--config ${CONFIGURATION}
--target ${TARGET_NAME}
-j
-j ${parallel_jobs}
WORKING_DIRECTORY ${BUILD_DIRECTORY}
RESULT_VARIABLE success
)
Expand Down
7 changes: 6 additions & 1 deletion cmake/diff-failed.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
set(testLog "Testing/Temporary/LastTestsFailed.log")
if(EXISTS ${testLog})
file(STRINGS ${testLog} failedTests)
if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
set(bc_command bc4.bat)
else ()
set(bc_command bcomp)
endif ()
foreach(test ${failedTests})
string(REGEX REPLACE "[0-9]+:[^;].*.(Regression|Run)" "\\1" test_type "${test}")
if(${test_type} MATCHES "Regression")
string(REGEX REPLACE "[0-9]+:([^;].*).Regression" "\\1" test_name "${test}")
string(TOUPPER ${test_name} test_name)
message("Diffing: ${test_name}.REP")
execute_process(COMMAND bc4.bat "${test_name}.REP" "${ref_dir}/${test_name}.REP"
execute_process(COMMAND ${bc_command} "${test_name}.REP" "${ref_dir}/${test_name}.REP"
WORKING_DIRECTORY ${test_dir}
RESULT_VARIABLE success
)
Expand Down
2 changes: 1 addition & 1 deletion src/RCDEF/rcdef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ int CDEC main( int argc, char * argv[] )
if (argc <= REQUIRED_ARGS || argc > REQUIRED_ARGS+2)
{
printf("\nExactly %d or %d args are required\n",
REQUIRED_ARGS, INT(REQUIRED_ARGS+1) );
REQUIRED_ARGS, REQUIRED_ARGS+1 );
exit(2); // do nothing if args not all present
// (Note reserving errorlevel 1 for possible
// future alternate good exit, 12-89)
Expand Down
6 changes: 3 additions & 3 deletions src/ashwat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ static string stringFmtV( const char* fmt, va_list ap=NULL)
static const int maxLen = 2000;
char buf[ maxLen];
if (ap)
{ int fRet = vsprintf_s( buf, maxLen, fmt, ap);
fmt = fRet >= 0 ? buf : "?? stringFmtV vsprintf_s failure.";
{ int fRet = vsnprintf( buf, maxLen, fmt, ap);
fmt = fRet >= 0 ? buf : "?? stringFmtV vsnprintf failure.";
}
return fmt;
} // ::stringFmtV
Expand Down Expand Up @@ -3960,7 +3960,7 @@ double RHOBF_BT_PERP, TAUBF_BB_PERP, TAUBF_BD_PERP;
else
geoCase = 6; // beam parallel to pleat sides (no direct illum on pleat back)

typedef void cdecl PDCASE( double, double, double, double,
typedef void PDCASE( double, double, double, double,
double, double, double, double, double, double,
double, double, double, double, double, double,
double, double, double, double,
Expand Down
3 changes: 1 addition & 2 deletions src/ashwface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ CFSTYX::CFSTYX( // build a CFS
const char* id, // unique ID (max len = CFSIDLEN)
float _UcogNFRC, // externally calculated NFRC cog U-factor, Btuh/ft2-F
float _SHGCcogNFRC, // externally calculated NFRC cog SHGC
[[maybe_unused]] const char* layer1ID, // ID of 1st layer
...) // add'l gap / layer info
// call = id, U, SHGC, layerID, gasID, gapT (inches), layerID, ...
{
Expand Down Expand Up @@ -986,7 +985,7 @@ RC FENAW::fa_Thermal( // ASHWAT thermal calcs

#if defined( _DEBUG)
for (int iL=0; iL<nL; iL++)
{ if (_isnan( awO.aw_TL[ iL])
{ if (std::isnan( awO.aw_TL[ iL])
|| awO.aw_TL[ iL] < 200.
|| awO.aw_TL[ iL] > 400.)
warn( "Window '%s': Implausible layer %d temp (%.f degF)\n",
Expand Down
2 changes: 1 addition & 1 deletion src/ashwface.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct CFSTYX : public CFSTY
float SHGCcogAW; // ASHWAT cog SHGC

CFSTYX() { Clear(); }
CFSTYX( const char* id, float _UcogNFRC, float _SHGCcogNFRC, const char* layer1ID, ...);
CFSTYX( const char* id, float _UcogNFRC, float _SHGCcogNFRC, ...);
void Clear();
// wrappers for CFSTY mbrs that to facilitate C++ <-> DLL comparisons
bool cfx_CalcRatings( float& Urat, float& SHGCrat);
Expand Down
8 changes: 4 additions & 4 deletions src/cgcomp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ void AIRFLOW::af_AccumDry( // add mass flow
}
}
#if defined( _DEBUG)
if (_isnan( af_amf))
if (std::isnan( af_amf))
printf( "af_AccumDry: NAN amf!\n");
#endif
} // AIRFLOW::af_AccumDry
Expand All @@ -587,7 +587,7 @@ double ZNR::zn_Rho0() const // zone air density
// Note: not *dry* air
{
double rho = psyDenMoistAir( tz, wz, LbSfToInHg(zn_pz0));
if (isnan( rho) || rho < .0001)
if (std::isnan( rho) || rho < .0001)
{ orMsg(ERRRT, "invalid moist air density (<=0 or nan)");
rho = 0.01; // set to small but physically possible value
}
Expand Down Expand Up @@ -1971,7 +1971,7 @@ RC IZXRAT::iz_BegSubhr() // set subhr constants
zp1->zn_GetAirStateLs( iz_air1);
iz_rho1 = zp1->zn_rho0ls; // density, lbm/cf
#if defined( _DEBUG)
if (isnan(iz_rho1))
if (std::isnan(iz_rho1))
printf("\nNAN");
if ((iz_IsSysOrDuct() || iz_IsOAVRelief()) != (iz_pAF != NULL))
err( PWRN, "IZXRAT '%s': inconsistent iz_pAF", Name());
Expand Down Expand Up @@ -2280,7 +2280,7 @@ void TOPRAT::tp_AirNetDestroy()
// finds zone pressures that achieve balanced mass flows
///////////////////////////////////////////////////////////////////////////////
#if defined( AIRNET_EIGEN)
#include <Eigen\Dense>
#include <Eigen/Dense>
using Eigen::MatrixXd;
using Eigen::VectorXd;

Expand Down
2 changes: 1 addition & 1 deletion src/cncult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ cnculti.h: cncult internal functions shared only amoung cncult,2,3,4,5,6.cpp */
/*============== CUL Tables (Initialized Data) and Functions ==============*/


#define N NULL // to shorten following data
#define N nullptr // to shorten following data
#define v (void *) // ..
#define nc(nck) ((void*)NCHOICE(nck)) // cnglob.h macro makes full 32-bit NCHOICE value from hi-word dtypes.h constant

Expand Down
2 changes: 1 addition & 1 deletion src/cncult4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ int RFI::rf_CheckAccessAndAlias(
strpathparts( fName, STRPPDRIVE|STRPPDIR|STRPPFNAME, fNameTry);
int lenBase = static_cast<int>(strlen(fNameTry));
char fExt[CSE_MAX_FILE_EXT];
_splitpath( fName, NULL, NULL, NULL, fExt);
xfpathext( fName, fExt);
for (int iTry=0; iTry<100; iTry++)
{ const char* suffix=fExt;
if (iTry > 0)
Expand Down
4 changes: 3 additions & 1 deletion src/cnglob.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,10 @@ template< typename T> inline void roundNearest( T &v, T rv)
inline int iRound( double a) { return int( a > 0. ? a+.5 : a-.5 ); }
// return v if not nan, else alternative value
template< typename T> inline T ifNotNaN( T v, T vForNaN=0)
{ return isnan( v) ? vForNaN : v; }
{ return std::isnan( v) ? vForNaN : v; }
//-----------------------------------------------------------------------------

#if !defined(NODTYPES)
// access to interval data
// returns ref to array mbr for C_IVLCH_H/D/M/Y
template< typename T> T& IvlData( T* ivlData, int ivl)
Expand All @@ -368,6 +369,7 @@ template< typename T> T& IvlData( T* ivlData, int ivl)
0 { VSet( ivlData+ivl1-C_IVLCH_Y, ivl2-ivl1+1, v);
0 }
#endif
#endif

/*---------------------------- dept of NANs: unset, nandles, nchoices ---------------------------*/

Expand Down
3 changes: 2 additions & 1 deletion src/cnloads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3519,6 +3519,7 @@ RC RSYS::rs_EndSubhr()
// verify RSYSRES_IVL_SUB layout at compile time
// fixed sequence allows array access by rs_mode (see code below)
// rsmHEAT/rsmCOOL/rsmOAV definitions must be consistent with member sequences.
#if 0 // TODO: Fix for non-MSVC compilers
#define QZONECHK( m, oDif) static_assert( &(((RSYSRES_IVL_SUB *)0)->m)-&(((RSYSRES_IVL_SUB *)0)->qhZoneSen) == oDif, "Bad seq " #m)
QZONECHK(qhZoneSen, (rsmHEAT - 1) * 2);
QZONECHK(qhZoneLat, (rsmHEAT - 1) * 2 + 1);
Expand All @@ -3528,7 +3529,7 @@ RC RSYS::rs_EndSubhr()
QZONECHK(qvZoneLat, (rsmOAV - 1) * 2 + 1);
static_assert(rsmCOUNT == 4, "Bad rsm enum");
#undef QZONECHK

#endif
if (rs_mode != rsmOFF)
{ // heat transfers from this RSYS to all zones (including duct losses)
const ZNR* zp;
Expand Down
6 changes: 2 additions & 4 deletions src/cse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@
/*------------------------------- INCLUDES --------------------------------*/
#include "cnglob.h"

#include <process.h> // exit

#include "ancrec.h" // record: base class for rccn.h classes
#include "rccn.h" // TOPRATstr

Expand Down Expand Up @@ -110,7 +108,7 @@ const char ProgName[] = "CSE";

const char ProgVersion[] = CSEVRSN_TEXT; // program version text "x.xxx" (csevrsn.h)

const char ProgVariant[] = // text showing platform
const char ProgVariant[] = // text showing platform TODO: Revise to use CSE_OS / CSE_COMPILER / CSE_ARCH
#if defined( WIN)
"for Win32";
#elif defined( DLL)
Expand Down Expand Up @@ -506,7 +504,7 @@ _DLLImpExp int CSEProgInfo( // returns
size_t bufSz)
// return # of characters written to buf
{
return _snprintf_s( buf, bufSz, _TRUNCATE,
return snprintf( buf, bufSz,
"%s %s %s", ProgName, ProgVersion, ProgVariant);
} // CSEInfo
} // extern "C"
Expand Down
6 changes: 3 additions & 3 deletions src/cul.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,7 @@ LOCAL RC FC culRATE( // do RATE cult entry
{
record *typeE;
if (b->tyB->findRecByNm1( typeName, NULL, /*VV*/ &typeE) != RCOK)
perlc( MH_S0229, c->id, typeName); // "%s type '%s' not found"
perlc( MH_S0229, c->id, typeName.CStr()); // "%s type '%s' not found"
// and continue here with raw record (perlc prevents RUN)
else // found
{
Expand Down Expand Up @@ -2870,7 +2870,7 @@ LOCAL RC bFind(
SI xdt;
SI cs = *pcs; // fetch case; returned updated if now 0
XSTK* x = xSp; // init to no context stack pops
char *whatDoTx = ttTx; // text for last token: "defty", "alter", "verb", etc
const char *whatDoTx = ttTx; // text for last token: "defty", "alter", "verb", etc
const char* ms=NULL; // for error message text.

// get next token for class name of object to defty/alter
Expand Down Expand Up @@ -3026,7 +3026,7 @@ LOCAL RC FC vFind( SI cs)
{
XSTK* x;
CULT *c;
char *id = ttTx; // save text of preceding verb for errMsgs
const char *id = ttTx; // save text of preceding verb for errMsgs

// next token is name of member or object to require/freeze/[alter/]delete
if (tkIf(CUTVRB)==0) // all member names are "verbs"
Expand Down
Loading