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

Provides functions to serialize various components of a nanowire network. 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 serialize_network (const datasheet ds, const network_topology nt, char *path, int id)
 Serialize the static characteristics of the Nanowire Network to a file named "nn.nns" in a folder named "device_ID", where ID is the univocal identifier of the NN. Any other file named the same will be overwritten. If any problem occurs, the program will exit with an error. More...
 
void serialize_state (const datasheet ds, const network_topology nt, const network_state ns, char *path, int id, int step)
 Serialize the network state (a.k.a. electrical equivalent circuit) to a file named "ns_STEP.nns" in a folder named "device_ID", where ID is the univocal identifier of the NN and STEP is the snapshot instant. Any other file named the same will be overwritten. If any problem occurs, the program will exit with an error. More...
 
void serialize_component (const connected_component cc, char *path, int nn_id, int cc_id)
 Serialize a connected component of a nanowire network to a file named "cc_CC_ID.nns" in a folder named "device_ID", where NN_ID is the univocal identifier of the NN and CC_ID is the univocal identified of the CC. Any other file named the same will be overwritten. If any problem occurs, the program will exit with an error. More...
 
void serialize_interface (const interface it, char *path, int id, int step)
 Serialize the network interface to a file named "it_STEP.nns" in a folder named "device_ID", where ID is the univocal identifier of the NN and STEP is the instant in which the interface was saved. Any other file named the same will be overwritten. If any problem occurs, the program will exit with an error. More...
 
void serialize_mea (const MEA mea, char *path, int id, int step)
 Serialize the network MEA to a file named "mea_STEP.nns" in a folder named "device_ID", where ID is the univocal identifier of the NN and STEP is the instant in which the MEA was saved. Any other file named the same will be overwritten. If any problem occurs, the program will exit with an error. More...
 

Detailed Description

Provides functions to serialize various components of a nanowire network.

This file contains function declarations for serializing datasheet and topology of a network, network state, connected components, network interface, and MEA (Multi-Electrode Array) to disk. Each serialization function creates or overwrites files in a folder named after the device identifier, following a specific naming convention for the files.

The functions ensure that any existing file with the same name will be replaced and will exit with an error if any issue occurs during the file operations.

Note
All file paths and names are based on a device identifier and may be overwritten. Ensure that the paths and identifiers are managed appropriately to avoid data loss.
If any error occurs during serialization, the program will exit with an error.

Function Documentation

◆ serialize_component()

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

Serialize a connected component of a nanowire network to a file named "cc_CC_ID.nns" in a folder named "device_ID", where NN_ID is the univocal identifier of the NN and CC_ID is the univocal identified of the CC. Any other file named the same will be overwritten. If any problem occurs, the program will exit with an error.

Parameters
[in]ccThe connected component to serialize.
[in]pathThe base path in which put the /device_ID folder.
[in]nn_idThe univocal id of the network that will determine its file name.
[in]cc_idThe index of the connected component.

◆ serialize_interface()

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

Serialize the network interface to a file named "it_STEP.nns" in a folder named "device_ID", where ID is the univocal identifier of the NN and STEP is the instant in which the interface was saved. Any other file named the same will be overwritten. If any problem occurs, the program will exit with an error.

Parameters
[in]itThe interface to serialize.
[in]pathThe base path in which put 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.

◆ serialize_mea()

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

Serialize the network MEA to a file named "mea_STEP.nns" in a folder named "device_ID", where ID is the univocal identifier of the NN and STEP is the instant in which the MEA was saved. Any other file named the same will be overwritten. If any problem occurs, the program will exit with an error.

Parameters
[in]meaThe MEA to serialize.
[in]pathThe base path in which put 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.

◆ serialize_network()

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

Serialize the static characteristics of the Nanowire Network to a file named "nn.nns" in a folder named "device_ID", where ID is the univocal identifier of the NN. Any other file named the same will be overwritten. If any problem occurs, the program will exit with an error.

Parameters
[in]dsThe datasheet to serialize.
[in]ntThe network topology to serialize.
[in]pathThe base path in which put the /device_ID folder.
[in]idThe univocal id of the network that will determine its file name.

◆ serialize_state()

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

Serialize the network state (a.k.a. electrical equivalent circuit) to a file named "ns_STEP.nns" in a folder named "device_ID", where ID is the univocal identifier of the NN and STEP is the snapshot instant. Any other file named the same will be overwritten. If any problem occurs, the program will exit with an error.

Parameters
[in]dsThe datasheet of the nanowire network to serialize.
[in]ntThe topology of the nanowire network to serialize.
[in]nsThe network state to serialize.
[in]pathThe base path in which put 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.