/[escript]/trunk/esys2/finley/test/SystemMatrixAdapter/SystemMatrixAdapterTestCase.cpp
ViewVC logotype

Contents of /trunk/esys2/finley/test/SystemMatrixAdapter/SystemMatrixAdapterTestCase.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 82 - (show annotations)
Tue Oct 26 06:53:54 2004 UTC (15 years, 2 months ago) by jgs
File size: 3369 byte(s)
Initial revision

1 /*
2 *****************************************************************************
3 * *
4 * COPYRIGHT ACcESS - All Rights Reserved *
5 * *
6 * This software is the property of ACcESS. No part of this code *
7 * may be copied in any form or by any means without the expressed written *
8 * consent of ACcESS. Copying, use or modification of this software *
9 * by any unauthorised person is illegal unless that person has a software *
10 * license agreement with ACcESS. *
11 * *
12 *****************************************************************************
13 */
14 #include "finley/CPPAdapter/SystemMatrixAdapter.h"
15 #include "finley/CPPAdapter/FinleyAdapterException.h"
16 #include "finley/CPPAdapter/FinleyError.h"
17
18 #include "SystemMatrixAdapterTestCase.h"
19
20 using namespace std;
21
22 using namespace CppUnitTest;
23
24 using namespace escript;
25 using namespace finley;
26
27 static Finley_Mesh *mesh;
28 static Finley_SystemMatrix *system_matrix;
29
30 static Finley_SystemMatrixType type;
31
32 static int symmetric;
33
34 static int row_blocksize;
35 static int column_blocksize;
36
37 static int reduce_row_order;
38 static int reduce_col_order;
39
40 static FunctionSpace row_functionspace;
41 static FunctionSpace colum_functionspace;
42
43 void SystemMatrixAdapterTestCase::setUp() {
44 //
45 // This is called before each test is run
46
47 mesh = Finley_Mesh_alloc("foo", 2, 1);
48
49 type = UNKNOWN;
50
51 symmetric = 0;
52
53 row_blocksize = 10;
54 column_blocksize = 10;
55
56 reduce_row_order = 0;
57 reduce_col_order = 0;
58
59 system_matrix = Finley_SystemMatrix_alloc(mesh, type, symmetric, row_blocksize, reduce_row_order, column_blocksize, reduce_col_order);
60
61 }
62
63 void SystemMatrixAdapterTestCase::tearDown() {
64 //
65 // This is called after each test has been run
66
67 Finley_SystemMatrix_dealloc(system_matrix);
68
69 }
70
71 void SystemMatrixAdapterTestCase::testAll() {
72 //
73 // The test code may be entered here
74 // There is nothing special about the function name, it may be renamed to
75 // something more suitable.
76 // As many test methods as desired may be added.
77
78 cout << endl;
79
80 try {
81 cout << "\tTest illegal default construction." << endl;
82 SystemMatrixAdapter system_matrix_adapter;
83 assert(false);
84 }
85 catch (FinleyAdapterException& e) {
86 cout << "\t" << e.toString() << endl;
87 assert(true);
88 }
89
90 cout << "\tTest constructor." << endl;
91
92 SystemMatrixAdapter system_matrix_adapter(system_matrix, row_blocksize, row_functionspace, column_blocksize, colum_functionspace);
93 Finley_SystemMatrix* adapter_system_matrix = system_matrix_adapter.getFinley_SystemMatrix();
94 assert(adapter_system_matrix == system_matrix);
95
96 cout << "\tExercise nullifyRowsAndCols." << endl;
97
98 Data row_q;
99 Data col_q;
100 double mdv = 1.0;
101
102 system_matrix_adapter.nullifyRowsAndCols(row_q, col_q, mdv);
103
104 }
105
106 TestSuite* SystemMatrixAdapterTestCase::suite ()
107 {
108 //
109 // create the suite of tests to perform.
110 TestSuite *testSuite = new TestSuite ("SystemMatrixAdapterTestCase");
111
112 testSuite->addTest (new TestCaller< SystemMatrixAdapterTestCase>("testAll",&SystemMatrixAdapterTestCase::testAll));
113 return testSuite;
114 }

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26