Functions | |
NContainer * | 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. | |
NTriangulation * | regina::readOrb (const char *filename) |
Reads a triangulation from the given Orb / Casson file. | |
NTriangulation * | regina::readSnapPea (const char *filename) |
Reads a triangulation from the given SnapPea file. | |
bool | regina::writeSnapPea (const char *filename, NTriangulation &tri) |
Writes the given triangulation to the given file in SnapPea format. | |
std::string | regina::stringToToken (const char *str) |
Returns a token derived from the given string. | |
std::string | regina::stringToToken (const std::string &str) |
Returns a token derived from the given string. |
NContainer* 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 NTriangulation::insertRehydration().
A newly allocated 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. |
NTriangulation* regina::readOrb | ( | const char * | filename | ) |
Reads a triangulation from the given Orb / Casson file.
A newly allocated triangulation will be returned; it is the user's responsibility to deallocate this when it is finished with.
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, 0 will be returned.
filename | the name of the Orb / Casson file from which to read. |
NTriangulation* regina::readSnapPea | ( | const char * | filename | ) |
Reads a triangulation from the given SnapPea file.
A newly allocated triangulation will be returned; it is the user's responsibility to deallocate this when it is finished with.
The packet label of the new triangulation will be the manifold name read from the second line of the SnapPea file. The first line of the SnapPea file must simply be ``% Triangulation
.
If the file could not be read or if the data was not in the correct format, 0 will be returned.
filename | the name of the SnapPea file from which to read. |
std::string regina::stringToToken | ( | const std::string & | str | ) |
Returns a token derived from the given string.
All whitespace characters in the given string will be replaced with an underscore.
str | the string on which to base the token. |
std::string regina::stringToToken | ( | const char * | str | ) |
Returns a token derived from the given string.
All whitespace characters in the given string will be replaced with an underscore.
str | the string on which to base the token. |
bool regina::writeSnapPea | ( | const char * | filename, | |
NTriangulation & | tri | |||
) |
Writes the given triangulation to the given file in SnapPea format.
All information aside from tetrahedron gluings will be flagged as unknown for SnapPea to recalculate. The manifold name written in the file will be derived from the packet label.
filename | the name of the SnapPea file to which to write. | |
tri | the triangulation to write to the SnapPea file. |
true
if the export was successful, or false
otherwise.