Regina 7.3 Calculation Engine
|
Reading and writing foreign file formats. More...
Functions | |
std::shared_ptr< Container > | regina::readDehydrationList (const char *filename, unsigned colDehydrations=0, int colLabels=-1, unsigned long ignoreLines=0) |
Reads a list of dehydrated triangulations from the given text file. More... | |
template<class ObjectType > | |
std::shared_ptr< Container > | regina::readSigList (const char *filename, unsigned colSigs=0, int colLabels=-1, unsigned long ignoreLines=0) |
Reads a list of isomorphism signatures or knot signatures from the given text file. More... | |
std::shared_ptr< PacketOf< Triangulation< 3 > > > | regina::readOrb (const char *filename) |
Reads a triangulation from the given Orb / Casson file. More... | |
Reading and writing foreign file formats.
std::shared_ptr< Container > regina::readDehydrationList | ( | const char * | filename, |
unsigned | colDehydrations = 0 , |
||
int | colLabels = -1 , |
||
unsigned long | ignoreLines = 0 |
||
) |
Reads a list of dehydrated triangulations from the given text file.
The file should contain one dehydration string per line. These strings will be rehydrated as described in Triangulation<3>::rehydrate().
A new container will be returned; the imported triangulations will be inserted as children of this container. The container will not be assigned a label. The individual triangulations will be assigned labels according to the parameter colLabels.
If any dehydrations strings are invalid, these will be recorded in an additional text packet that will be the last child of the returned container.
If an I/O error occurred while trying to read the given file, 0 will be returned.
In its simplest form, the text file can simply contain one dehydration string per line and nothing else. However, more complex formats are allowed. In particular, by passing appropriate values for the arguments colDehydrations and colLabels, the dehydration strings and triangulation packet labels can be taken from arbitrary columns of the text file. Columns are considered to be separated by whitespace and are numbered beginning at 0.
filename | the name of the text file from which to read. |
colDehydrations | the column of the text file containing the dehydration strings. |
colLabels | the column of the text file containing the triangulation packet labels. If this is negative then the dehydration strings themselves will be used as packet labels. |
ignoreLines | the number of lines at the beginning of the text file that should be ignored completely. |
null
if an I/O error occurred whilst reading the given file. std::shared_ptr< PacketOf< Triangulation< 3 > > > regina::readOrb | ( | const char * | filename | ) |
Reads a triangulation from the given Orb / Casson file.
A new triangulation packet will be returned.
The packet label of the new triangulation will be the manifold name read from the second line of the Orb / Casson file. The first line of the Orb / Casson file must simply be: % orb
If the file could not be read or if the data was not in the correct format, null
will be returned.
filename | the name of the Orb / Casson file from which to read. |
null
on error.std::shared_ptr< Container > regina::readSigList | ( | const char * | filename, |
unsigned | colSigs = 0 , |
||
int | colLabels = -1 , |
||
unsigned long | ignoreLines = 0 |
||
) |
Reads a list of isomorphism signatures or knot signatures from the given text file.
The file should contain one signature per line. Signatures for knots or triangulations of any dimension are all accepted, though the type of object must be known in advance and fixed for the entire function call using the template parameter ObjectType. These signatures will be converted into knots and/or triangulations using Link::fromKnotSig() and Triangulation<dim>::fromIsoSig() respectively.
A new container will be returned; the imported knots or triangulations will be inserted as children of this container. The container will not be assigned a label. The individual knots or triangulations will be assigned labels according to the parameter colLabels.
If any signatures are invalid, these will be recorded in an additional text packet that will be the last child of the returned container.
If an I/O error occurred while trying to read the given file, null
will be returned.
In its simplest form, the text file can simply contain one signature per line and nothing else. However, more complex formats are allowed. In particular, by passing appropriate values for the arguments colSigs and colLabels, the signatures and packet labels can be taken from arbitrary columns of the text file. Columns are considered to be separated by whitespace and are numbered beginning at 0.
ObjectType | Indicates which types of signatures the file contains. This must be either Link (indicating that the file contains knot signatures), or one of the Triangulation<dim> classes (indicating that the file contains isomorphism signatures for dim-dimensional triangulations). |
filename | the name of the text file from which to read. |
colSigs | the column of the text file containing the signatures. |
colLabels | the column of the text file containing the packet labels for the resulting knots or triangulations. If this is negative then the signatures themselves will be used as packet labels. |
ignoreLines | the number of lines at the beginning of the text file that should be ignored completely. |
null
if an I/O error occurred whilst reading the given file.