From 76f3f92a300121f30998d60bd12b10f8c6fd0e2a Mon Sep 17 00:00:00 2001 From: blendoit Date: Mon, 7 Oct 2019 02:57:01 -0700 Subject: final Evaluator implementation --- creator/base.py | 17 +++++++++++------ creator/wing.py | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'creator') diff --git a/creator/base.py b/creator/base.py index 5d90efd..33ea680 100644 --- a/creator/base.py +++ b/creator/base.py @@ -20,6 +20,9 @@ class Aircraft: self.propulsion = None self.wing = None + def __str__(self): + return self.name + class Component: """Basic component providing coordinates, tools and a component tree.""" @@ -38,11 +41,11 @@ class Component: print(num_of_dashes * '-') print(name) for k, v in self.__dict__.items(): - if type(v) != list: + if type(v) is not np.ndarray: print(f'{k}:\n', v) print(num_of_dashes * '-') for k, v in self.__dict__.items(): - if type(v) == list: + if type(v) is np.ndarray: print(f'{k}:\n', np.around(v, round)) return None @@ -54,14 +57,16 @@ class Component: try: with open(full_path, 'w') as f: for k, v in self.__dict__.items(): - if type(v) != list: - f.write(f'{k}:\n') + if type(v) is not np.ndarray: + f.write(f'{k}=\n') f.write(str(v)) + f.write("\n") # print(num_of_dashes * '-') for k, v in self.__dict__.items(): - if type(v) == list: - f.write(f'{k}:\n') + if type(v) is np.ndarray: + f.write(f'{k}=\n') f.write(str(v)) + f.write("\n") logging.debug(f'Successfully wrote to file {full_path}') except IOError: print(f'Unable to write {file_name} to specified directory.\n', diff --git a/creator/wing.py b/creator/wing.py index 472e928..b21a68c 100644 --- a/creator/wing.py +++ b/creator/wing.py @@ -55,7 +55,7 @@ class Airfoil(base.Component): def __str__(self): return self.name - def add_naca(self, naca_num): + def add_naca(self, naca_num=2412): """Generate surface geometry for a NACA airfoil. The nested functions perform the required steps to generate geometry, -- cgit v1.2.3