Skip to content

Commit

Permalink
Add a helper to set the input file line content
Browse files Browse the repository at this point in the history
  • Loading branch information
sanguinariojoe committed Aug 28, 2024
1 parent f9327f7 commit 93e2d27
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/map/src/mapapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "numeric.h"
#include "jacobian.h"
#include "residual.h"
#include <string.h>


MAP_EXTERNCALL void map_initialize_msqs_base(MAP_InputType_t* u_type,
Expand Down Expand Up @@ -1161,6 +1162,12 @@ MAP_EXTERNCALL void map_set_gravity(MAP_ParameterType_t* p_type, const double gr
p_type->g = gravity;
};

MAP_EXTERNCALL void map_set_input_text(MAP_InitInputType_t* init_type, const char* input_txt_line)
{
strncpy(init_type->library_input_str, input_txt_line, 254);

This comment has been minimized.

Copy link
@andrew-platt

andrew-platt Sep 12, 2024

Collaborator

Some compilers don't seem to like strncpy. Will make a PR to address this.

init_type->library_input_str[254] = '\0';
}


MAP_EXTERNCALL void map_add_cable_library_input_text(MAP_InitInputType_t* init_type)
{
Expand Down
1 change: 1 addition & 0 deletions modules/map/src/mapapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ MAP_EXTERNCALL void map_initialize_msqs_base(MAP_Input_t u_type, MAP_Parameter_t


MAP_EXTERNCALL void set_init_to_null(MAP_InitInput_t init_type, char* map_msg, MAP_ERROR_CODE* ierr);
MAP_EXTERNCALL void map_set_input_text(MAP_InitInput_t init_type, const char* input_txt_line);
MAP_EXTERNCALL void map_add_cable_library_input_text(MAP_InitInput_t init_type);
MAP_EXTERNCALL void map_add_node_input_text(MAP_InitInput_t init_type);
MAP_EXTERNCALL void map_add_line_input_text(MAP_InitInput_t init_type);
Expand Down

0 comments on commit 93e2d27

Please sign in to comment.