Exemple #1
0
    def writeGEFDCCellFile(self, outputdir=None, filename='cell.inp',
                           triangles=False, maxcols=125):
        """
        Generates the cell definition/ASCII-art file for GEFDC.

        .. warning:
           This whole thing is probably pretty buggy.

        Parameters
        ----------
        outputdir : str, optional
            The path to where the should be saved.
        filename : str, optional
            The name of the output file.
        triangles : bool, optional
            Toggles the inclusion of triangular cells.

            .. warning:
               This is experimental and probably buggy if it has been
               implmented at all.

        maxcols : int, optional
            The maximum number of columns to write to each row. Cells
            beyond this number will be writted in separate section at
            the bottom of the file.

        Returns
        -------
        cells : str
            The text of the output file.

        """

        cells = misc.make_gefdc_cells(
            ~np.isnan(self.xn), self.cell_mask, triangles=triangles
        )
        outfile = iotools._outputfile(outputdir, filename)

        iotools._write_cellinp(cells, outputfile=outfile,
                               flip=True, maxcols=maxcols)
        return cells
Exemple #2
0
 def test_chunked(self):
     iotools._write_cellinp(self.cells, self.chunked_output, maxcols=5)
     testing.compareTextFiles(
         self.chunked_output,
         self.known_chunked_output
     )
Exemple #3
0
 def test_basic(self):
     iotools._write_cellinp(self.cells, self.basic_output)
     testing.compareTextFiles(
         self.basic_output,
         self.known_basic_output
     )