commit c666a188f44ae7f479ded3882cfd38df94bb0871
parent dec065214e6f3da5048b37013513f6f2098e309f
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Mon, 15 Mar 2021 13:08:05 +0100
Adapt to file format change introduced for Thermal Contact Resistances
Diffstat:
3 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/src/green-compute.c b/src/green-compute.c
@@ -236,7 +236,7 @@ build_green_table
INSERT(i, initial_T);
}
}
- else if(desc->type == DESC_SOLID_FLUID_CONNECT) {
+ else if(DESC_IS_CONNECTION(desc->type)) {
/* No variables here */
}
else { /*Corrupted file??? */
diff --git a/src/green-input.c b/src/green-input.c
@@ -65,7 +65,7 @@ read_green_function
unsigned i;
char* pool_ptr;
const char expected_green_string[] = "GREEN_BIN_FILE:";
- const unsigned expected_file_fmt_version = 1;
+ const unsigned expected_file_fmt_version = 2;
char green_string[sizeof(expected_green_string)];
unsigned file_fmt_version;
@@ -90,6 +90,18 @@ read_green_function
/* Read counts */
FR(&green->counts, 1);
+ if(green->counts.desc_count !=
+ (green->counts.smed_count + green->counts.fmed_count
+ + green->counts.tbound_count + green->counts.hbound_count
+ + green->counts.fbound_count + green->counts.sfconnect_count
+ + green->counts.ssconnect_count))
+ {
+ logger_print(green->logger, LOG_ERROR,
+ "Inconsistant description counts (%u).\n",
+ green->counts.desc_count);
+ res = RES_BAD_ARG;
+ goto error;
+ }
/* Read descriptions*/
green->descriptions = MEM_CALLOC(green->allocator, green->counts.desc_count,
diff --git a/src/green-types.h b/src/green-types.h
@@ -79,15 +79,15 @@ log_prt(const char* msg, void* ctx)
/*
* Counts read from the binary file
*/
-struct green_counts {
+struct bfile_green_counts {
unsigned desc_count, smed_count, fmed_count, tbound_count, hbound_count,
- fbound_count, sfconnect_count, name_pool_sz;
+ fbound_count, sfconnect_count, ssconnect_count, name_pool_sz;
size_t ok_count, failed_count;
};
static INLINE void
init_green_counts
- (struct green_counts* counts)
+ (struct bfile_green_counts* counts)
{
ASSERT(counts);
counts->desc_count = 0;
@@ -97,6 +97,7 @@ init_green_counts
counts->hbound_count = 0;
counts->fbound_count = 0;
counts->sfconnect_count = 0;
+ counts->ssconnect_count = 0;
counts->name_pool_sz = 0;
counts->ok_count = 0;
counts->failed_count = 0;
@@ -262,7 +263,7 @@ struct result {
struct green {
struct mem_allocator* allocator;
struct logger* logger;
- struct green_counts counts;
+ struct bfile_green_counts counts;
char* names_pool;
struct description* descriptions;
double ambient_temp, ref_temp;
@@ -349,6 +350,7 @@ enum description_type {
DESC_BOUND_T_FOR_SOLID,
DESC_BOUND_F_FOR_SOLID,
DESC_SOLID_FLUID_CONNECT,
+ DESC_SOLID_SOLID_CONNECT,
DESCRIPTION_TYPE_COUNT__,
DESC_OUTSIDE
};
@@ -363,6 +365,10 @@ enum description_type {
((D) == DESC_BOUND_F_FOR_SOLID)
#define DESC_IS_SF(D) \
((D) == DESC_SOLID_FLUID_CONNECT)
+#define DESC_IS_SS(D) \
+ ((D) == DESC_SOLID_SOLID_CONNECT)
+#define DESC_IS_CONNECTION(D) \
+ (DESC_IS_SS(D) || DESC_IS_SF(D))
#define DESC_HOLDS_T(D) \
(DESC_IS_MEDIUM(D) || DESC_IS_H(D) || DESC_IS_T(D))
@@ -427,6 +433,12 @@ struct solid_fluid_connect {
unsigned connection_id;
};
+struct solid_solid_connect {
+ struct str name;
+ double tcr;
+ unsigned connection_id;
+};
+
struct description {
enum description_type type;
union {
@@ -436,6 +448,7 @@ struct description {
struct f_boundary f_boundary;
struct h_boundary h_boundary;
struct solid_fluid_connect sf_connect;
+ struct solid_solid_connect ss_connect;
} d;
};
@@ -466,6 +479,9 @@ get_description_name
case DESC_SOLID_FLUID_CONNECT:
*name = &desc->d.sf_connect.name;
break;
+ case DESC_SOLID_SOLID_CONNECT:
+ *name = &desc->d.ss_connect.name;
+ break;
default:
return RES_BAD_ARG;
}