Ejemplo n.º 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
Ejemplo n.º 2
0
 def test_output(self):
     cells = misc.make_gefdc_cells(self.nodes, cell_mask=self.mask,
                                   triangles=self.triangles)
     nptest.assert_array_equal(cells, self.known_cells)