Exemple #1
0
 def setUp(self):
     desired_file = Paths.get_module_path_file(self.test_data_file, __file__)
     env = self.environment = FillamentEnvironment(desired_file)
     self.DUT = FillamentCurrentSource()
     self.DUT.set_function_space(env.discretisation_space)
     self.DUT.set_no_integration_points(env.no_integration_points)
     self.DUT.set_source_endpoints(env.source_endpoints)
     self.DUT.set_value(env.I)
 def test_get_RHS(self):
     self.DUT.set_frequency(self.frequency)
     self.DUT.init_problem()
     actual_RHS = self.DUT.get_RHS()
     # test data generated using a suspected-working version on 31 May 2011
     desired_file = Paths.get_module_path_file('RHS_vector.pickle', __file__)
     desired_RHS    = pickle.load(desired_file)
     self.assertTrue(N.allclose(
         actual_RHS, desired_RHS, rtol=1e-12, atol=1e-16))
 def test_get_LHS_matrix(self):
     self.DUT.set_frequency(self.frequency)
     self.DUT.init_problem()
     # test data generated using a suspected-working version on 31 May 2011
     actual_LHSmat = self.DUT.get_LHS_matrix().todense()
     desired_file = Paths.get_module_path_filename('LHS_matrix.npy', __file__)
     desired_LHSmat = N.load(desired_file)
     self.assertTrue(N.allclose(
         actual_LHSmat, desired_LHSmat, rtol=1e-10, atol=3e-15))
Exemple #4
0
 def test_get_RHS(self):
     self.DUT.set_frequency(self.frequency)
     self.DUT.init_problem()
     actual_RHS = self.DUT.get_RHS()
     # test data generated using a suspected-working version on 31 May 2011
     desired_file = Paths.get_module_path_file('RHS_vector.pickle',
                                               __file__)
     desired_RHS = pickle.load(desired_file)
     self.assertTrue(
         N.allclose(actual_RHS, desired_RHS, rtol=1e-12, atol=1e-16))
Exemple #5
0
 def test_get_LHS_matrix(self):
     self.DUT.set_frequency(self.frequency)
     self.DUT.init_problem()
     # test data generated using a suspected-working version on 31 May 2011
     actual_LHSmat = self.DUT.get_LHS_matrix().todense()
     desired_file = Paths.get_module_path_filename('LHS_matrix.npy',
                                                   __file__)
     desired_LHSmat = N.load(desired_file)
     self.assertTrue(
         N.allclose(actual_LHSmat, desired_LHSmat, rtol=1e-10, atol=3e-15))
 def setUp(self):
     data_dir = Paths.get_module_path_filename(self.data_dir,  __file__)
     data_file = open(os.path.join(data_dir, self.test_data_file))
     data = self.data = pickle.load(data_file)
     self.mesh = dolfin.Mesh(os.path.join(data_dir, data['meshfile']))
     self.discretisation_order = data['order']
     self.function_space = dolfin.FunctionSpace(
         self.mesh, "Nedelec 1st kind H(curl)", self.discretisation_order)
     self.k0 = 2*np.pi*data['freq']/c0
     self.DUT = power_flux.VariationalSurfaceFlux(self.function_space)
 def setUp(self):
     data_dir = Paths.get_module_path_filename(self.data_dir, __file__)
     data_file = open(os.path.join(data_dir, self.test_data_file))
     data = self.data = pickle.load(data_file)
     self.mesh = dolfin.Mesh(os.path.join(data_dir, data['meshfile']))
     self.discretisation_order = data['order']
     self.function_space = dolfin.FunctionSpace(self.mesh,
                                                "Nedelec 1st kind H(curl)",
                                                self.discretisation_order)
     self.k0 = 2 * np.pi * data['freq'] / c0
     self.DUT = power_flux.VariationalSurfaceFlux(self.function_space)
Exemple #8
0
 def setUp(self):
     desired_file = Paths.get_module_path_file(self.test_data_file, __file__)
     self.environment = NTFFEnvironment(desired_file)
     self.DUT = surface_ntff.NTFF(self.environment.discretisation_space)
Exemple #9
0
 def setUp(self):
     desired_file = Paths.get_module_path_file(self.test_data_file, __file__)
     self.desired_data = pickle.load(desired_file)