Skip to content

Commit

Permalink
Merge pull request #198 from bigladder/improve-dynamic-alloc
Browse files Browse the repository at this point in the history
Improve dynamic allocation of btwxt objects
  • Loading branch information
nealkruis authored Jan 11, 2024
2 parents b3e2507 + d3a6bef commit 583d4dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/HPWH.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ class HPWH::HeatSource
/**< The values for input power and cop use matching to the grid. Should be long format with { {
* inputPower_W }, { COP } }. */

class Btwxt::RegularGridInterpolator* perfRGI;
std::shared_ptr<Btwxt::RegularGridInterpolator> perfRGI;
/**< The grid interpolator used for mapping performance*/

bool useBtwxtGrid;
Expand Down
8 changes: 5 additions & 3 deletions src/HPWHpresets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1843,8 +1843,8 @@ int HPWH::HPWHinit_presets(MODELS presetNum)
}

// Set up regular grid interpolator.
compressor.perfRGI =
new Btwxt::RegularGridInterpolator(compressor.perfGrid, compressor.perfGridValues);
compressor.perfRGI = std::make_shared<Btwxt::RegularGridInterpolator>(
Btwxt::RegularGridInterpolator(compressor.perfGrid, compressor.perfGridValues));
compressor.useBtwxtGrid = true;

// set everything in its places
Expand Down Expand Up @@ -2214,7 +2214,9 @@ int HPWH::HPWHinit_presets(MODELS presetNum)

std::vector<Btwxt::GridAxis> gx {g0, g1, g2};

compressor.perfRGI = new Btwxt::RegularGridInterpolator(gx, compressor.perfGridValues);
compressor.perfRGI = std::make_shared<Btwxt::RegularGridInterpolator>(
Btwxt::RegularGridInterpolator(gx, compressor.perfGridValues));

compressor.useBtwxtGrid = true;

compressor.secondaryHeatExchanger = {dF_TO_dC(10.), dF_TO_dC(15.), 27.};
Expand Down

0 comments on commit 583d4dd

Please sign in to comment.