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

Annotation of /trunk/finley/test/SystemMatrixAdapter/SystemMatrixAdapterTestCase.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 97 - (hide annotations)
Tue Dec 14 05:39:33 2004 UTC (18 years, 3 months ago) by jgs
Original Path: trunk/esys2/finley/test/SystemMatrixAdapter/SystemMatrixAdapterTestCase.cpp
File size: 3609 byte(s)
*** empty log message ***

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26