YetAnotherCoupler  2.4.1
Example on how to use XML routines from config_xml.h

If a component's name is known and is present in the given coupling xml file, more information about the component can be retrieved by this name. This is e.g. the component ID, or the transients it contains, and grids it uses.

If the component name is given as a char*, the ID can be retrieved like this:

int component_id;
if (component_name_exists_in_xml(component_name)) {
component_id = get_component_id_by_component_name(component_name);
}

Given the component ID, information about the component and its transients and grids can be retrieved.

This example shows how to get information about the component's transients.

int number_of_transients = get_number_of_transients_by_component_id(component_id);
transient* transients = malloc(number_of_transients * sizeof(transient));
get_transients_by_component_id(component_id, transients);
for (int i = 0; i < number_of_transients; i++) {
printf("Transient name: %s ID: %s \n", transients[i].name, transients[i].global_id);
}
...
free(transients);

Information about its grids can be retrieved respectively.

Information about couples of components and transients are retrieved by i.e. iterating through all existing couples. One couple contains several transient couples. Elements can be accessed as shown here.

int number_of_couples = get_number_of_couples();
// for all couples
for (int i = 0; i < number_of_couples; i++) {
int number_of_transient_couples =
get_number_of_transient_couples(i);
// for all transient couples
for (int j = 0; j < number_of_transient_couples; j++) {
int source_component_id = get_source_component_id(i, j);
int target_component_id = get_target_component_id(i, j);
int source_transient_id = get_source_transient_id(i, j);
int target_transient_id = get_target_transient_id(i, j);
...
}
...
}