Skip to content

Commit

Permalink
valgrind fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kulakovri committed Feb 13, 2024
1 parent 435ba89 commit 5270592
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions MDLIB/Main_DOODZ.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ void RunMDOODZ(char *inputFileName, MdoodzSetup *setup) {
};

if (input.model.free_surface) {
input.topo_height = &(TopoHeight){
.east = -0.0e3,
.west = -0.0e3,
};
input.topo_height = malloc(sizeof(TopoHeight));
if (input.topo_height != NULL) {
*input.topo_height = (TopoHeight){.east = -0.0e3, .west = -0.0e3};
}
}

if (setup->MutateInput) {
Expand Down Expand Up @@ -112,6 +112,7 @@ void RunMDOODZ(char *inputFileName, MdoodzSetup *setup) {

// Allocate marker chain
markers topo_chain, topo_chain_ini;
topo_chain.Nb_part = 0;
surface topo, topo_ini;
if (input.model.free_surface == 1 ) AllocateMarkerChain( &topo, &topo_chain, input.model );
if (input.model.free_surface == 1 ) AllocateMarkerChain( &topo_ini, &topo_chain_ini, input.model );
Expand Down
3 changes: 2 additions & 1 deletion MDLIB/Setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ void SetBCs(SetBCs_ff setBCs, MdoodzInput *instance, grid *mesh, markers *topo_c
double VxWestSum = 0.0;
double VxEastSum = 0.0;

if (instance->topo_height && topo_chain->Nb_part && topo_chain->z[0] && topo_chain->z[topo_chain->Nb_part - 1]) {
if (instance->topo_height != NULL
&& topo_chain->Nb_part > 0) {
instance->topo_height->west = topo_chain->z[0];
instance->topo_height->east = topo_chain->z[topo_chain->Nb_part - 1];
}
Expand Down

0 comments on commit 5270592

Please sign in to comment.