nns.c  1.0.1
Nanowire Network simulator
deserializer.h File Reference

Defines deserialization functions for all the data structures of the library. More...

#include "device/network.h"
#include "device/component.h"
#include "interface/interface.h"
#include "interface/mea.h"

Go to the source code of this file.

Functions

void deserialize_network (datasheet *ds, network_topology *nt, char *path, int id)
 Deserialize the static characteristics of the network from a file named "nanowire_network.ID.dat", where ID is the univocal identifier of the NN. If any problem occurs, the program will exit with an error. More...
 
void deserialize_state (const datasheet ds, const network_topology nt, network_state *ns, char *path, int id, int step)
 Deserialize the state of the network from a file named "nanowire_state.ID.dat", where ID is the univocal identifier of the NN. If any problem occurs, the program will exit with an error. More...
 
void deserialize_component (connected_component *cc, char *path, int nn_id, int cc_id)
 Deserialize a network connected component. NN_ID is the univocal identifier of the NN. If any problem occurs, the program will exit with an error. More...
 
void deserialize_interface (interface *it, char *path, int id, int step)
 Deserialize the interface to the network from a file named "it_STEP.dat", where ID is the univocal identifier of the NN and STEP is the instant in which the interface was saved. If any problem occurs, the program will exit with an error. More...
 
void deserialize_mea (MEA *mea, char *path, int id, int step)
 Deserialize the MEA of the network from a file named "mea_STEP.nns" where ID is the univocal identifier of the NN and STEP is the instant in which the MEA was saved. If any problem occurs, the program will exit with an error. More...
 

Detailed Description

Defines deserialization functions for all the data structures of the library.

This file contains declarations for functions used to deserialize various components of a nanowire network from files. These components include the network's datasheet, topology, state, connected components, interface, and MEA (Multi-Electrode Array). The deserialization process involves reading data from files named according to specific conventions, which include unique identifiers.

Note
If any error occurs during deserialization, the program will exit with an error.

Function Documentation

◆ deserialize_component()

void deserialize_component ( connected_component cc,
char *  path,
int  nn_id,
int  cc_id 
)

Deserialize a network connected component. NN_ID is the univocal identifier of the NN. If any problem occurs, the program will exit with an error.

Parameters
ccThe connected component to deserialize.
pathThe base path containing the /device_ID folder.
nn_idThe univocal id of the network that will determine its folder name.
cc_idThe index of the connected component.

◆ deserialize_interface()

void deserialize_interface ( interface it,
char *  path,
int  id,
int  step 
)

Deserialize the interface to the network from a file named "it_STEP.dat", where ID is the univocal identifier of the NN and STEP is the instant in which the interface was saved. If any problem occurs, the program will exit with an error.

Parameters
[out]itThe interface to set according to the data saved in the file. It has to not be initialized.
[in]pathThe base path containing the /device_ID folder.
[in]idThe univocal id of the network that will determine its file name.
[in]stepThe id of the network interface in a specific instant.

◆ deserialize_mea()

void deserialize_mea ( MEA mea,
char *  path,
int  id,
int  step 
)

Deserialize the MEA of the network from a file named "mea_STEP.nns" where ID is the univocal identifier of the NN and STEP is the instant in which the MEA was saved. If any problem occurs, the program will exit with an error.

Parameters
[out]itThe interface to set according to the data saved in the file. It has to not be initialized.
[in]pathThe base path containing the /device_ID folder.
[in]idThe univocal id of the network that will determine its file name.
[in]stepThe id of the network MEA in a specific instant.

◆ deserialize_network()

void deserialize_network ( datasheet ds,
network_topology nt,
char *  path,
int  id 
)

Deserialize the static characteristics of the network from a file named "nanowire_network.ID.dat", where ID is the univocal identifier of the NN. If any problem occurs, the program will exit with an error.

Parameters
[out]dsThe datasheet to set according to the data saved in the file. It has to not be initialized.
[out]ntThe network topology to set according to the data saved in the file. It has to not be initialized.
[in]pathThe base path containing the /device_ID folder.
[in]idThe univocal id of the network that will determine its file name.

◆ deserialize_state()

void deserialize_state ( const datasheet  ds,
const network_topology  nt,
network_state ns,
char *  path,
int  id,
int  step 
)

Deserialize the state of the network from a file named "nanowire_state.ID.dat", where ID is the univocal identifier of the NN. If any problem occurs, the program will exit with an error.

Parameters
[in]dsThe datasheet of the nanowire network to deserialize.
[in]ntThe topology of the nanowire network to deserialize.
[out]nsThe network state to set according to the data saved in the file. It has to not be initialized.
[in]pathThe base path containing the /device_ID folder.
[in]idThe univocal id of the network that will determine its file name.
[in]stepThe id of the network state in a specific instant.