コード例 #1
0
    def load(self, filepath, **kwargs):
        r"""
        Load an OGS5 mesh from file.

        kwargs will be forwarded to "tools.load_ogs5msh"

        Parameters
        ----------
        filepath : string
            path to the '\*.msh' OGS5 mesh file to load
        verbose : bool, optional
            Print information of the reading process. Default: True
        ignore_unknown : bool, optional
            Unknown data in the file will be ignored. Default: False
        max_node_no : int, optional
            If you know the maximal node number per elements in the mesh file,
            you can optimise the reading a bit. By default the algorithm will
            assume hexahedrons as 'largest' elements in the mesh. Default: 8
        encoding : str or None, optional
            encoding of the given file. If ``None`` is given, the system
            standard is used. Default: ``None``

        Notes
        -----
        The $AREA keyword within the Nodes definition is NOT supported
        and will violate the read data if present.
        """
        #        kwargs["verbose"] = True
        tmp = load_ogs5msh(filepath, **kwargs)
        if isinstance(tmp, list) and not isinstance(self, MSH):
            print(
                filepath
                + " may contains a multi-layer mesh."
                + "Try loading within the multimesh class."
            )
        elif not isinstance(tmp, list):
            tmp = [tmp]
        if "verbose" in kwargs:
            verbose = kwargs["verbose"]
        else:
            verbose = False
        if check_mesh_list(tmp, verbose=verbose):
            self._block = 0
            self._meshlist = tmp
        else:
            raise ValueError("MSH: " + filepath + ": given mesh is not valid")
コード例 #2
0
ファイル: core.py プロジェクト: joergbuchwald/ogs5py
    def check(self, verbose=True):
        """
        Check if the mesh is valid in the sence, that the
        contained data is consistent.
        Checks for correct element definitions or Node duplicates
        are not carried out.

        Parameters
        ----------
        verbose : bool, optional
            Print information for the executed checks. Default: True

        Returns
        -------
        result : bool
            Validity of the given mesh.
        """
        return check_mesh_list(self._meshlist, verbose=verbose)