/**
 * Frees this model.  Does not free the production type names.
 *
 * @param self the model.
 */
void
local_free (struct naadsm_model_t_ *self)
{
  local_data_t *local_data;

#if DEBUG
  g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "----- ENTER free (%s)", MODEL_NAME);
#endif

  /* Free the dynamically-allocated parts. */
  local_data = (local_data_t *) (self->model_data);
  g_free (local_data->production_type);
  PDF_free_dist (local_data->latent_period);
  PDF_free_dist (local_data->infectious_subclinical_period);
  PDF_free_dist (local_data->infectious_clinical_period);
  PDF_free_dist (local_data->immunity_period);
  if (local_data->prevalence != NULL)
    REL_free_chart (local_data->prevalence);
  g_free (local_data);
  g_ptr_array_free (self->outputs, TRUE);
  g_free (self);

#if DEBUG
  g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "----- EXIT free (%s)", MODEL_NAME);
#endif
}
Beispiel #2
0
/**
 * Frees this model.  Does not free the production type name.
 *
 * @param self the model.
 */
void
local_free (struct ergadm_model_t_ *self)
{
  local_data_t *local_data;

#if DEBUG
  g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "----- ENTER free (%s)", MODEL_NAME);
#endif

  /* Free the dynamically-allocated parts. */
  local_data = (local_data_t *) (self->model_data);
  g_free (local_data->production_type);
  REL_free_chart (local_data->visiting);
  REL_free_chart (local_data->testing);

  RPT_free_reporting (local_data->total_cost, TRUE);
  RPT_free_reporting (local_data->appraisal_cost, TRUE);
  RPT_free_reporting (local_data->euthanasia_cost, TRUE);
  RPT_free_reporting (local_data->indemnification_cost, TRUE);
  RPT_free_reporting (local_data->carcass_disposal_cost, TRUE);
  RPT_free_reporting (local_data->cleaning_disinfecting_cost, TRUE);
  RPT_free_reporting (local_data->vaccination_cost, TRUE);
  RPT_free_reporting (local_data->cumul_total_cost, TRUE);
  RPT_free_reporting (local_data->cumul_appraisal_cost, TRUE);
  RPT_free_reporting (local_data->cumul_euthanasia_cost, TRUE);
  RPT_free_reporting (local_data->cumul_indemnification_cost, TRUE);
  RPT_free_reporting (local_data->cumul_carcass_disposal_cost, TRUE);
  RPT_free_reporting (local_data->cumul_cleaning_disinfecting_cost, TRUE);
  RPT_free_reporting (local_data->cumul_vaccination_cost, TRUE);

  g_free (local_data);
  g_ptr_array_free (self->outputs, TRUE);
  g_free (self);

#if DEBUG
  g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "----- EXIT free (%s)", MODEL_NAME);
#endif
}