# Path: phon/io_tools/read/read_from_abaqus_inp.py
# def read_from_abaqus_inp(filename, verbose=0):
#     """
#     Reads a mesh file in Abaqus .inp format and stores it into a
#     Mesh class object.
# 
#     :param filename: The name of the file from where to read the mesh from.
#     :type filename: string
#     :param verbose: Determines what level of print out to the console.
#     :type verbose: 0, 1 or 2
#     :return: A mesh class containing the read mesh objects.
#     :rtype: :class:`phon.mesh_objects.mesh()`
#     :raises ReadInpFileError: If specific syntax error are found.
# 
#     """
# 
#     with open(filename, "rU") as f:
# 
#         # Read mesh objects
#         num_elems = 0
#         mesh = Mesh("temp_name")
#         while True:
#             start_of_line = f.tell()
#             keyword = f.readline()
#             if f.readline() == "":
#                 break
#             keyword = keyword.strip().split(",")[0]
#             f.seek(start_of_line)
# 
#             if keyword.lower() == "*part":
#                 _read_part(f, mesh, verbose)
#             elif keyword.lower() == "*node":
#                 _read_nodes(f, mesh, verbose)
#             elif keyword.lower() == "*element":
#                 num_elems += _read_elements(f, mesh, num_elems, verbose)
#             elif keyword.lower() == "*elset":
#                 _read_element_set(f, mesh, verbose)
#             elif keyword.lower() == "*nset":
#                 _read_node_set(f, mesh, verbose)
#             elif keyword.lower() == "*end part":
#                 break
#             else:
#                 f.readline()
# 
#                 continue
# 
#         f.close()
# 
#         return mesh
# 
# Path: phon/io_tools/read/read_from_abaqus_inp.py
# def to_number(number):
#     """
#     Converts a string to a int if possible, else a float.
# 
#     :param number: The string to convert to a number
#     :type number: string
# 
#     :return: The converted number
#     :rtype: : int or float depending on the format of the string
# 
#     """
#     try:
#         return int(number)
#     except ValueError:
#         return float(number)


import unittest
import os
from phon.io_tools.read.read_from_abaqus_inp import read_from_abaqus_inp
from phon.io_tools.read.read_from_abaqus_inp import to_number
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""




__location__ = os.path.realpath(
    os.path.join(os.getcwd(), os.path.dirname(__file__)))


class Test(unittest.TestCase):
    """Unit tests for read_from_neper_inp."""

    def setUp(self):

# Path: phon/io_tools/read/read_from_abaqus_inp.py
# def read_from_abaqus_inp(filename, verbose=0):
#     """
#     Reads a mesh file in Abaqus .inp format and stores it into a
#     Mesh class object.
# 
#     :param filename: The name of the file from where to read the mesh from.
#     :type filename: string
#     :param verbose: Determines what level of print out to the console.
#     :type verbose: 0, 1 or 2
#     :return: A mesh class containing the read mesh objects.
#     :rtype: :class:`phon.mesh_objects.mesh()`
#     :raises ReadInpFileError: If specific syntax error are found.
# 
#     """
# 
#     with open(filename, "rU") as f:
# 
#         # Read mesh objects
#         num_elems = 0
#         mesh = Mesh("temp_name")
#         while True:
#             start_of_line = f.tell()
#             keyword = f.readline()
#             if f.readline() == "":
#                 break
#             keyword = keyword.strip().split(",")[0]
#             f.seek(start_of_line)
# 
#             if keyword.lower() == "*part":
#                 _read_part(f, mesh, verbose)
#             elif keyword.lower() == "*node":
#                 _read_nodes(f, mesh, verbose)
#             elif keyword.lower() == "*element":
#                 num_elems += _read_elements(f, mesh, num_elems, verbose)
#             elif keyword.lower() == "*elset":
#                 _read_element_set(f, mesh, verbose)
#             elif keyword.lower() == "*nset":
#                 _read_node_set(f, mesh, verbose)
#             elif keyword.lower() == "*end part":
#                 break
#             else:
#                 f.readline()
# 
#                 continue
# 
#         f.close()
# 
#         return mesh
# 
# Path: phon/io_tools/read/read_from_abaqus_inp.py
# def to_number(number):
#     """
#     Converts a string to a int if possible, else a float.
# 
#     :param number: The string to convert to a number
#     :type number: string
# 
#     :return: The converted number
#     :rtype: : int or float depending on the format of the string
# 
#     """
#     try:
#         return int(number)
#     except ValueError:
#         return float(number)


# Path: test/test_read_from_neper_inp.py
import unittest
import os
from phon.io_tools.read.read_from_abaqus_inp import read_from_abaqus_inp
from phon.io_tools.read.read_from_abaqus_inp import to_number

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""




__location__ = os.path.realpath(
    os.path.join(os.getcwd(), os.path.dirname(__file__)))


class Test(unittest.TestCase):
    """Unit tests for read_from_neper_inp."""

    def setUp(self):

        self.mesh = read_from_abaqus_inp(os.path.join(__location__, "mesh_test_files/n10-id1.inp"), verbose=0)