/[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 155 - (hide annotations)
Wed Nov 9 02:02:19 2005 UTC (16 years, 1 month ago) by jgs
File size: 3638 byte(s)
move all directories from trunk/esys2 into trunk and remove esys2

1 jgs 102 // $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 102 #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 102 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 102 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 102 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 jgs 150 // this fails on gcc ...
74     //Finley_SystemMatrix_dealloc(system_matrix);
75 jgs 82
76     }
77    
78     void SystemMatrixAdapterTestCase::testAll() {
79     //
80     // The test code may be entered here
81     // There is nothing special about the function name, it may be renamed to
82     // something more suitable.
83     // As many test methods as desired may be added.
84    
85     cout << endl;
86    
87     try {
88     cout << "\tTest illegal default construction." << endl;
89     SystemMatrixAdapter system_matrix_adapter;
90     assert(false);
91     }
92     catch (FinleyAdapterException& e) {
93     cout << "\t" << e.toString() << endl;
94     assert(true);
95     }
96    
97     cout << "\tTest constructor." << endl;
98    
99     SystemMatrixAdapter system_matrix_adapter(system_matrix, row_blocksize, row_functionspace, column_blocksize, colum_functionspace);
100     Finley_SystemMatrix* adapter_system_matrix = system_matrix_adapter.getFinley_SystemMatrix();
101     assert(adapter_system_matrix == system_matrix);
102    
103     cout << "\tExercise nullifyRowsAndCols." << endl;
104    
105     Data row_q;
106     Data col_q;
107     double mdv = 1.0;
108    
109     system_matrix_adapter.nullifyRowsAndCols(row_q, col_q, mdv);
110    
111     }
112    
113     TestSuite* SystemMatrixAdapterTestCase::suite ()
114     {
115     //
116     // create the suite of tests to perform.
117     TestSuite *testSuite = new TestSuite ("SystemMatrixAdapterTestCase");
118    
119     testSuite->addTest (new TestCaller< SystemMatrixAdapterTestCase>("testAll",&SystemMatrixAdapterTestCase::testAll));
120     return testSuite;
121     }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26