mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 05:05:30 -04:00
Free C++ tally filter memory
This commit is contained in:
parent
b27242e726
commit
3e953ef7cf
3 changed files with 27 additions and 0 deletions
|
|
@ -51,5 +51,9 @@ public:
|
|||
virtual void initialize() = 0;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
||||
extern "C" void free_memory_tally_c();
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLY_FILTER_H
|
||||
|
|
|
|||
|
|
@ -15,6 +15,22 @@ namespace openmc {
|
|||
std::vector<TallyFilterMatch> filter_matches;
|
||||
std::vector<TallyFilter*> tally_filters;
|
||||
|
||||
//==============================================================================
|
||||
// Non-member functions
|
||||
//==============================================================================
|
||||
|
||||
void
|
||||
free_memory_tally_c()
|
||||
{
|
||||
#pragma omp parallel
|
||||
{
|
||||
filter_matches.clear();
|
||||
}
|
||||
|
||||
for (TallyFilter* filt : tally_filters) {delete filt;}
|
||||
tally_filters.clear();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// Fortran compatibility functions
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -412,6 +412,13 @@ contains
|
|||
!===============================================================================
|
||||
|
||||
subroutine free_memory_tally()
|
||||
interface
|
||||
subroutine free_memory_tally_c() bind(C)
|
||||
end subroutine free_memory_tally_c
|
||||
end interface
|
||||
|
||||
call free_memory_tally_c()
|
||||
|
||||
n_tallies = 0
|
||||
if (allocated(tallies)) deallocate(tallies)
|
||||
call tally_dict % clear()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue