# Path: postproclib/postproc.py
# class PostProc:
# 
#     def __str__(self):
#         string =  ('\nAvailable outputs in ' + self.resultsdir + ' include:\n\n')
#         string += ('\t{0:^24s}\t{1:>10s}\n'.format('field', 'records'))
#         #string += ('\t{0:^24s}\t{1:^10s}\n'.format('-'*24, '-'*10))
#         for key,field in sorted(self.plotlist.items()):
#             line = '\t{0:<24s}=\t{1:>10f},\n'.format(key, field.maxrec)
#             string += line
#         return string 
# 
# Path: postproclib/pplexceptions.py
# class NoResultsInDir(Exception):
#     pass


import os
import glob
from .openfoamfields import *
from .postproc import PostProc
from .pplexceptions import NoResultsInDir 
            if ("controlDict" in files):
                controlDictfound = True
                with open(root+"/controlDict") as f:
                    for line in f:
                        try:
                            if "writeControl" in line:
                                writecontrol = (line.replace("\t"," ")
                                                    .replace(";","")
                                                    .replace("\n","")
                                                    .split(" ")[-1])
                            if "writeInterval" in line:
                                writeInterval = float(line.replace("\t"," ")
                                                          .replace(";","")
                                                          .replace("\n","")
                                                          .split(" ")[-1])

                            if "deltaT" in line:
                                deltaT = float(line.replace("\t"," ")
                                                   .replace(";","")
                                                   .replace("\n","")
                                                   .split(" ")[-1])
                        except ValueError:
                            print(("Convert failed in OpenFOAM_reader", line))

            if "processor" in root and not parallel_run:
                parallel_run = True
                print(("Assuming parallel run as processor folder found in " + self.resultsdir))

        #Check if data files exist
        if not controlDictfound:

# Path: postproclib/postproc.py
# class PostProc:
# 
#     def __str__(self):
#         string =  ('\nAvailable outputs in ' + self.resultsdir + ' include:\n\n')
#         string += ('\t{0:^24s}\t{1:>10s}\n'.format('field', 'records'))
#         #string += ('\t{0:^24s}\t{1:^10s}\n'.format('-'*24, '-'*10))
#         for key,field in sorted(self.plotlist.items()):
#             line = '\t{0:<24s}=\t{1:>10f},\n'.format(key, field.maxrec)
#             string += line
#         return string 
# 
# Path: postproclib/pplexceptions.py
# class NoResultsInDir(Exception):
#     pass


# Path: postproclib/openfoampostproc.py
import os
import glob
from .openfoamfields import *
from .postproc import PostProc
from .pplexceptions import NoResultsInDir 

            if ("controlDict" in files):
                controlDictfound = True
                with open(root+"/controlDict") as f:
                    for line in f:
                        try:
                            if "writeControl" in line:
                                writecontrol = (line.replace("\t"," ")
                                                    .replace(";","")
                                                    .replace("\n","")
                                                    .split(" ")[-1])
                            if "writeInterval" in line:
                                writeInterval = float(line.replace("\t"," ")
                                                          .replace(";","")
                                                          .replace("\n","")
                                                          .split(" ")[-1])

                            if "deltaT" in line:
                                deltaT = float(line.replace("\t"," ")
                                                   .replace(";","")
                                                   .replace("\n","")
                                                   .split(" ")[-1])
                        except ValueError:
                            print(("Convert failed in OpenFOAM_reader", line))

            if "processor" in root and not parallel_run:
                parallel_run = True
                print(("Assuming parallel run as processor folder found in " + self.resultsdir))

        #Check if data files exist
        if not controlDictfound:

            raise NoResultsInDir