TEST_F(TestDoubleClearSingleSystemNoSun, Test1) { SCOPED_TRACE("Begin Test: Double Clear Single System - Surface temperatures"); auto aSystem = GetSystem(); ASSERT_TRUE(aSystem != nullptr); auto Temperature = aSystem->getTemperatures(); std::vector<double> correctTemperature = {258.756688, 259.359226, 279.178510, 279.781048}; ASSERT_EQ(correctTemperature.size(), Temperature.size()); for(auto i = 0u; i < correctTemperature.size(); ++i) { EXPECT_NEAR(correctTemperature[i], Temperature[i], 1e-5); } auto Radiosity = aSystem->getRadiosities(); std::vector<double> correctRadiosity = {251.950834, 268.667346, 332.299338, 359.731700}; ASSERT_EQ(correctRadiosity.size(), Radiosity.size()); for(auto i = 0u; i < correctRadiosity.size(); ++i) { EXPECT_NEAR(correctRadiosity[i], Radiosity[i], 1e-5); } auto heatFlow = aSystem->getHeatFlow(Tarcog::ISO15099::Environment::Indoor); EXPECT_NEAR(105.431019, heatFlow, 1e-5); auto Uvalue = aSystem->getUValue(); EXPECT_NEAR(2.703359, Uvalue, 1e-5); auto numOfIter = aSystem->getNumberOfIterations(); EXPECT_EQ(20u, numOfIter); }
TEST_F(TestDoubleClearIndoorShadeAir, Test1) { SCOPED_TRACE("Begin Test: Indoor Shade - Air"); auto aSystem = GetSystem(); auto temperature = aSystem->getTemperatures(); auto radiosity = aSystem->getRadiosities(); std::vector<double> correctTemp = { 258.2265788, 258.7403799, 276.1996405, 276.7134416, 288.1162677, 288.1193825}; std::vector<double> correctJ = { 250.2066021, 264.5687123, 319.49179, 340.4531177, 382.6512706, 397.0346045}; EXPECT_EQ(correctTemp.size(), temperature.size()); EXPECT_EQ(correctJ.size(), radiosity.size()); for(size_t i = 0; i < temperature.size(); ++i) { EXPECT_NEAR(correctTemp[i], temperature[i], 1e-6); EXPECT_NEAR(correctJ[i], radiosity[i], 1e-6); } const auto numOfIter = aSystem->getNumberOfIterations(); EXPECT_EQ(1, int(numOfIter)); const auto ventilatedFlow = aSystem->getVentilationFlow(Tarcog::ISO15099::Environment::Indoor); EXPECT_NEAR(40.066868, ventilatedFlow, 1e-6); }
void peanoclaw::records::RepositoryState::toString (std::ostream& out) const { out << "("; out << "action:" << toString(getAction()); out << ","; out << "numberOfIterations:" << getNumberOfIterations(); out << ")"; }
peanoclaw::records::RepositoryStatePacked peanoclaw::records::RepositoryState::convert() const{ return RepositoryStatePacked( getAction(), getNumberOfIterations() ); }
int main(int argc, char* argv[] ) { srand(time(NULL)); int verbose = 0; char outputFile[256]; int doOutput = getWriteToFile( argc, argv, outputFile, 256); if (argc == 1) { showUsageAndExit(); } moleculizer* pMoleculizer = createNewMoleculizerObject(); setRateExtrapolation( pMoleculizer, 1 ); int result = loadModelFile( pMoleculizer, argc, argv); switch(result) { case 0: printf("Model loaded successfully.\n"); break; case 1: printf("Unknown error on load. Aborting\n"); return 1; case 2: printf("Document unparsable. Aborting.\n"); return 1; case 3: printf("Moleculizer has already loaded rules. Ignoring and continuing.\n"); return 1; } int numIter = getNumberOfIterations(argc, argv); int maxSpecies = getMaxNumSpecies( argc, argv); int maxRxns = getMaxNumReactions( argc, argv); if (numIter > 0 && (maxSpecies > 0 || maxRxns > 0) ) { // ANCHOR printf("Error, if either (max species and/or max rxns) can be set or numIters. "); showUsageAndExit(); } verbose = getVerbose(argc, argv); if(numIter == -1 ) { int numRxns; int numSpec; species** speciesArray; reaction** rxnArray; int errorCode = \ getBoundedNetwork( pMoleculizer, maxSpecies, maxRxns, &speciesArray, &numSpec, &rxnArray, &numRxns ); if (errorCode) { printf("Unknown erorr. Check error messages for description. Exiting...\n"); exit(1); } else { numIter = 10; printf("Network generated to %d species and %d reactions.\n", numSpec, numRxns); } } else { int iter = 0; for( iter = 0; iter != numIter; ++iter) { species** theSpecies; int numSpecies = 0; getAllExteriorSpecies( pMoleculizer, &theSpecies, &numSpecies); if (numSpecies == 0) { printf("Entire network has been generated on the %dth iteration.\n", iter); freeSpeciesArray( theSpecies, numSpecies); break; } /* Get a random number in the range [0, numSpecies) */ int speciesNumber = rand() % numSpecies; printf("Iteration %d: Expanding %s\n", iter + 1, theSpecies[speciesNumber]->name); incrementSpecies( pMoleculizer, theSpecies[speciesNumber]->name); freeSpeciesArray( theSpecies, numSpecies); } } if (numIter == -1) { printf("Expanded entire network.\n"); } else { printf("Expanded %d iterations.", numIter); } printf("\n##########################################\n"); printf("There are %d species and %d reactions.\n", getNumberOfSpecies(pMoleculizer), getNumberOfReactions(pMoleculizer) ); if ( verbose ) { showAllSpecies( pMoleculizer ); showAllReactions( pMoleculizer); } if (doOutput) { writeDotFile(pMoleculizer, outputFile); } freeMoleculizerObject( pMoleculizer ); return 0; }