Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • bdc/cats
1 result
Select Git revision
Show changes
Showing
with 31 additions and 79 deletions
......@@ -30,6 +30,7 @@
#include "stats/grid_stats.h"
#include "paths/output_paths.h"
#include "bdc_memory/bdc_memory.h"
#include "bdc_io/bdc_io.h"
#ifdef USEMPI
#include "mpi/mpi_stats.h"
......
......@@ -25,6 +25,7 @@
#include "inline.h"
#include "metadata.h"
#include "inline_vital_rates.h"
#include "bdc_io/bdc_io.h"
FILE *
......
......@@ -23,7 +23,7 @@
#include <assert.h>
#include <stdlib.h>
#include "statistics.h"
#include "cats_strings/cats_strings.h"
#include "bdc_strings/bdc_strings.h"
#include "bdc_memory/bdc_memory.h"
#include "configuration/configuration.h"
......
......@@ -27,6 +27,8 @@
#include "misc/cats_random.h"
#include "stats/grid_stats.h"
#include "bdc_memory/bdc_memory.h"
#include "data/error.h"
void create_custom_stats_for_thread(struct statistics *thread_stats, struct statistics *grid_stats)
{
......
......@@ -20,7 +20,7 @@
//
#include "default_vital_ages.h"
#include <logging/logging.h>
#include <bdc_logging/logging.h>
const char *get_vital_age_name(enum cats_vital_age_id idx)
{
......
......@@ -21,7 +21,7 @@
#include <math.h>
#include <assert.h>
#include <cats_strings/cats_strings.h>
#include <bdc_strings/bdc_strings.h>
#include "logging.h"
#include "setup_rates.h"
#include "string.h"
......
......@@ -21,7 +21,7 @@
#include <math.h>
#include "vital_rate_ranges.h"
#include "logging/logging.h"
#include "bdc_logging/logging.h"
int check_vital_rate_hybrid(struct cats_vital_rate *vr)
......
......@@ -13,4 +13,4 @@ target_sources(cats_csv
set_property(TARGET cats_csv PROPERTY POSITION_INDEPENDENT_CODE ON)
target_link_libraries(cats_logging bdc cats_strings)
\ No newline at end of file
target_link_libraries(bdc_logging bdc bdc_strings)
\ No newline at end of file
......@@ -26,8 +26,9 @@
#include <string.h>
#include "cats_csv.h"
#include <logging/logging.h>
#include <bdc_logging/logging.h>
#include "bdc_memory/bdc_memory.h"
#include "bdc_io/bdc_io.h"
struct cats_csv *csv_new(char *header_line, int32_t expected_fields)
......@@ -42,21 +43,21 @@ struct cats_csv *csv_new(char *header_line, int32_t expected_fields)
struct string_array *headers = get_all_tokens(header_line, ",");
if (headers->count != expected_fields) {
log_message(LOG_ERROR, "%s: disparity in field count: got %d expected %d\n", __func__, headers->count,
if (get_string_count(headers) != expected_fields) {
log_message(LOG_ERROR, "%s: disparity in field count: got %d expected %d\n", __func__, get_string_count(headers),
expected_fields);
exit(EXIT_FAILURE);
}
struct cats_csv *result = malloc_or_die_trace(sizeof(struct cats_csv), __func__);
result->column_count = headers->count;
result->column_count = get_string_count(headers);
result->data_row_count = 0;
result->data = NULL;
result->headers = malloc_or_die_trace(result->column_count * sizeof(char *), __func__);
for (int32_t i = 0; i < headers->count; i++) {
result->headers[i] = strdup(headers->string[i]);
for (int32_t i = 0; i < get_string_count(headers); i++) {
result->headers[i] = strdup(get_string(headers, i));
}
free_string_array(&headers);
......@@ -224,8 +225,8 @@ void csv_add_row(struct cats_csv *csv, char *line)
struct string_array *data = get_all_tokens(line, ",");
if (csv->column_count != data->count) {
log_message(LOG_ERROR, "%s: disparity in field count: got %d expected %d\n", __func__, data->count,
if (csv->column_count != get_string_count(data)) {
log_message(LOG_ERROR, "%s: disparity in field count: got %d expected %d\n", __func__, get_string_count(data),
csv->column_count);
exit(EXIT_FAILURE);
}
......@@ -233,14 +234,14 @@ void csv_add_row(struct cats_csv *csv, char *line)
csv->data_row_count = csv->data_row_count + 1;
csv->data = realloc(csv->data, csv->data_row_count * sizeof(char **));
csv->data = realloc_or_die(csv->data, csv->data_row_count * sizeof(char **));
int32_t row = csv->data_row_count - 1;
csv->data[row] = malloc_or_die_trace(fields * sizeof(char *), __func__);
for (int32_t i = 0; i < csv->column_count; i++) {
csv->data[row][i] = strdup(data->string[i]);
csv->data[row][i] = strdup(get_string(data,i));
}
......
......@@ -24,7 +24,7 @@
#include <stdint.h>
#include <stdio.h>
#include <cats_strings/cats_strings.h>
#include <bdc_strings/bdc_strings.h>
///@brief Data structure for simple csv files
struct cats_csv {
......
......@@ -18,4 +18,4 @@ target_sources(cats_ini
set_property(TARGET cats_ini PROPERTY POSITION_INDEPENDENT_CODE ON)
target_link_libraries(cats_logging cats_strings bdc)
target_link_libraries(bdc_strings bdc_logging bdc)
......@@ -28,8 +28,8 @@
#include <string.h>
#include <stddef.h>
#include <cats_strings/cats_strings.h>
#include <logging/logging.h>
#include <bdc_strings/bdc_strings.h>
#include <bdc_logging/logging.h>
#include "cats_ini.h"
......
......@@ -25,7 +25,7 @@
#include "cats_ini_helpers.h"
#include "cats_ini_write_values.h"
#include "misc/misc.h"
#include <logging/logging.h>
#include <bdc_logging/logging.h>
void add_complement_value_read(struct cats_ini *ini, char *section, char *key)
{
......
......@@ -22,12 +22,10 @@
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "../logging/logging.h"
#include "bdc_logging/logging.h"
#include "cats_ini.h"
#include "../cats_strings/cats_strings.h"
#include "bdc_strings/bdc_strings.h"
#include "cats_ini_read_values.h"
#include "../cats_strings/string_helpers.h"
#include "cats_ini_helpers.h"
#include <stdio.h>
......
......@@ -20,10 +20,9 @@
//
#include "cats_ini_helpers.h"
#include "../cats_strings/string_helpers.h"
#include "cats_ini.h"
#include "../logging/logging.h"
#include "../cats_strings/cats_strings.h"
#include "bdc_logging/logging.h"
#include "bdc_strings/bdc_strings.h"
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
......
add_library(cats_strings STATIC "" ../cats_defs.h ../cats_windows.h string_converters.c string_converters.h)
target_sources(cats_strings
PRIVATE
cats_strings.c
io_text.c
string_helpers.c
pretty_print.c
PUBLIC
cats_strings.h
io_text.h
pretty_print.h
string_helpers.h
)
set_property(TARGET cats_strings PROPERTY POSITION_INDEPENDENT_CODE ON)
target_link_libraries(cats_logging cats_time)
\ No newline at end of file
// SPDX-License-Identifier: GPL-3.0-or-later
//
// pretty_print.h
//
// Copyright (C) 2011-2024, University of Vienna and Vienna Institute for Nature Conservation & Analyses, Andreas Gattringer.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or (at
// your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
#ifndef CATS_PRETTY_PRINT_H
#define CATS_PRETTY_PRINT_H
#endif //CATS_PRETTY_PRINT_H
add_library(cats_time STATIC "" ../cats_defs.h ../cats_windows.h)
target_sources(cats_time
PRIVATE
cats_time.c cats_time.h
)
set_property(TARGET cats_time PROPERTY POSITION_INDEPENDENT_CODE ON)
target_link_libraries(cats_time)
\ No newline at end of file
......@@ -24,4 +24,4 @@ target_sources(cats-butterflies
set_property(TARGET cats-butterflies PROPERTY POSITION_INDEPENDENT_CODE ON)
target_link_libraries(cats-butterflies cats_logging libcats)
target_link_libraries(cats-butterflies bdc_logging libcats)
......@@ -39,6 +39,7 @@ struct cats_debug_options cats_debug;
#include "lambda/leslie_matrix.h"
#include "actions/setup_actions.h"
#include "butterflies_scale.h"
#include "bdc_io/bdc_io.h"
cats_dt_rates bf_expected_local_eggs_per_female(struct cats_configuration *conf, struct cats_grid *grid, cats_dt_coord row, cats_dt_coord col)
......