/[escript]/trunk/paso/src/SystemMatrixPattern.cpp
ViewVC logotype

Contents of /trunk/paso/src/SystemMatrixPattern.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4803 - (show annotations)
Wed Mar 26 06:52:28 2014 UTC (5 years, 10 months ago) by caltinay
File size: 5103 byte(s)
Removed obsolete wrappers for malloc and friends.
Paso_Pattern -> paso::Pattern

1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2014 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16
17
18 /****************************************************************************/
19
20 /* Paso: SystemMatrixPattern */
21
22 /****************************************************************************/
23
24 /* Author: Lutz Gross, l.gross@uq.edu.au */
25
26 /****************************************************************************/
27
28 #include "Paso.h"
29 #include "SystemMatrixPattern.h"
30
31 namespace paso {
32
33 // constructor for a SystemMatrixPattern
34 SystemMatrixPattern::SystemMatrixPattern(int patType,
35 Paso_Distribution* outDist, Paso_Distribution* inDist,
36 Pattern* mainPat, Pattern* colPat, Pattern* rowPat,
37 Connector* colConn, Connector* rowConn)
38 {
39 Esys_resetError();
40
41 if (outDist->mpi_info != inDist->mpi_info) {
42 Esys_setError(SYSTEM_ERROR, "SystemMatrixPattern: output distribution and input distribution MPI communicators don't match.");
43 }
44 if (outDist->mpi_info != colConn->mpi_info) {
45 Esys_setError(SYSTEM_ERROR, "SystemMatrixPattern: output distribution and col connector MPI communicators don't match.");
46 }
47 if (outDist->mpi_info != rowConn->mpi_info ) {
48 Esys_setError(SYSTEM_ERROR, "SystemMatrixPattern: output distribution and row connector MPI communicators don't match.");
49 }
50 if (mainPat->type != patType) {
51 Esys_setError(VALUE_ERROR, "SystemMatrixPattern: type of mainPattern does not match expected type.");
52 }
53 if (colPat->type != patType) {
54 Esys_setError(VALUE_ERROR, "SystemMatrixPattern: type of col couplePattern does not match expected type.");
55 }
56 if (rowPat->type != patType) {
57 Esys_setError(VALUE_ERROR, "SystemMatrixPattern: type of row couplePattern does not match expected type.");
58 }
59 if (colPat->numOutput != mainPat->numOutput) {
60 Esys_setError(VALUE_ERROR, "SystemMatrixPattern: number of outputs for couple and main pattern don't match.");
61 }
62 if (mainPat->numOutput != Paso_Distribution_getMyNumComponents(outDist)) {
63 Esys_setError(VALUE_ERROR, "SystemMatrixPattern: number of outputs and given distribution don't match.");
64 }
65 if (mainPat->numInput != Paso_Distribution_getMyNumComponents(inDist)) {
66 Esys_setError(VALUE_ERROR, "SystemMatrixPattern: number of input for main pattern and number of send components in connector don't match.");
67 }
68 if (colPat->numInput != colConn->recv->numSharedComponents) {
69 Esys_setError(VALUE_ERROR, "SystemMatrixPattern: number of inputs for column couple pattern and number of received components in connector don't match.");
70 }
71 if (rowPat->numOutput != rowConn->recv->numSharedComponents) {
72 Esys_setError(VALUE_ERROR, "SystemMatrixPattern: number of inputs for row couple pattern and number of received components in connector don't match.");
73 }
74
75 type=patType;
76 reference_counter=1;
77 mainPattern=Pattern_getReference(mainPat);
78 row_couplePattern=Pattern_getReference(rowPat);
79 col_couplePattern=Pattern_getReference(colPat);
80 row_connector=Connector_getReference(rowConn);
81 col_connector=Connector_getReference(colConn);
82 output_distribution=Paso_Distribution_getReference(outDist);
83 input_distribution=Paso_Distribution_getReference(inDist);
84 mpi_info = Esys_MPIInfo_getReference(outDist->mpi_info);
85 #ifdef Paso_TRACE
86 printf("SystemMatrixPattern: system matrix pattern has been allocated.\n");
87 #endif
88 }
89
90 // returns a reference to in
91 SystemMatrixPattern* SystemMatrixPattern_getReference(SystemMatrixPattern* in)
92 {
93 if (in != NULL) {
94 ++(in->reference_counter);
95 }
96 return in;
97 }
98
99 // deallocates a SystemMatrixPattern
100 void SystemMatrixPattern_free(SystemMatrixPattern* in)
101 {
102 if (in != NULL) {
103 in->reference_counter--;
104 if (in->reference_counter <= 0) {
105 Pattern_free(in->mainPattern);
106 Pattern_free(in->row_couplePattern);
107 Pattern_free(in->col_couplePattern);
108 Connector_free(in->row_connector);
109 Connector_free(in->col_connector);
110 Paso_Distribution_free(in->output_distribution);
111 Paso_Distribution_free(in->input_distribution);
112 Esys_MPIInfo_free(in->mpi_info);
113 delete in;
114 #ifdef Paso_TRACE
115 printf("SystemMatrixPattern_free: system matrix pattern has been deallocated.\n");
116 #endif
117 }
118 }
119 }
120
121 dim_t SystemMatrixPattern_getNumOutput(const SystemMatrixPattern* in)
122 {
123 if (in != NULL) {
124 return in->mainPattern->numOutput;
125 }
126 return 0;
127 }
128
129 } // namespace paso
130

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision
svn:mergeinfo /branches/amg_from_3530/paso/src/SystemMatrixPattern.cpp:3531-3826 /branches/lapack2681/paso/src/SystemMatrixPattern.cpp:2682-2741 /branches/pasowrap/paso/src/SystemMatrixPattern.cpp:3661-3674 /branches/py3_attempt2/paso/src/SystemMatrixPattern.cpp:3871-3891 /branches/restext/paso/src/SystemMatrixPattern.cpp:2610-2624 /branches/ripleygmg_from_3668/paso/src/SystemMatrixPattern.cpp:3669-3791 /branches/stage3.0/paso/src/SystemMatrixPattern.cpp:2569-2590 /branches/symbolic_from_3470/paso/src/SystemMatrixPattern.cpp:3471-3974 /branches/symbolic_from_3470/ripley/test/python/paso/src/SystemMatrixPattern.cpp:3517-3974 /release/3.0/paso/src/SystemMatrixPattern.cpp:2591-2601 /trunk/paso/src/SystemMatrixPattern.cpp:4257-4344 /trunk/ripley/test/python/paso/src/SystemMatrixPattern.cpp:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26