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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4803 - (show annotations)
Wed Mar 26 06:52:28 2014 UTC (5 years, 9 months ago) by caltinay
File size: 4315 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_unrollBlocks */
21
22 /****************************************************************************/
23
24 /* Author: Lutz Gross, l.gross@uq.edu.au */
25
26 /****************************************************************************/
27
28 #include "SystemMatrixPattern.h"
29 #include "Paso.h"
30 #include "esysUtils/error.h"
31
32 namespace paso {
33
34 SystemMatrixPattern* SystemMatrixPattern_unrollBlocks(
35 SystemMatrixPattern* pattern, int type, dim_t output_block_size,
36 dim_t input_block_size)
37 {
38 SystemMatrixPattern* out = NULL;
39 Pattern *new_mainPattern=NULL, *new_col_couplePattern=NULL, *new_row_couplePattern=NULL;
40 Paso_Distribution *new_output_distribution=NULL, *new_input_distribution=NULL;
41 Connector *new_col_connector=NULL, *new_row_connector=NULL;
42
43 if ( (output_block_size == 1) && (input_block_size == 1) &&
44 ((pattern->type & MATRIX_FORMAT_OFFSET1) == (type & MATRIX_FORMAT_OFFSET1)) ) {
45 out = SystemMatrixPattern_getReference(pattern);
46 } else {
47 new_mainPattern = Pattern_unrollBlocks(pattern->mainPattern, type,
48 output_block_size, input_block_size);
49 new_col_couplePattern = Pattern_unrollBlocks(
50 pattern->col_couplePattern, type, output_block_size,
51 input_block_size);
52 new_row_couplePattern = Pattern_unrollBlocks(
53 pattern->row_couplePattern, type, output_block_size,
54 input_block_size);
55 if (output_block_size > 1) {
56 new_output_distribution = Paso_Distribution_alloc(
57 pattern->output_distribution->mpi_info,
58 pattern->output_distribution->first_component,
59 output_block_size, 0);
60 new_row_connector = Connector_unroll(pattern->row_connector,
61 output_block_size);
62 } else {
63 new_output_distribution = Paso_Distribution_getReference(pattern->output_distribution);
64 new_row_connector = Connector_getReference(pattern->row_connector);
65 }
66 if (input_block_size > 1) {
67 new_input_distribution = Paso_Distribution_alloc(
68 pattern->input_distribution->mpi_info,
69 pattern->input_distribution->first_component,
70 input_block_size, 0);
71 new_col_connector = Connector_unroll(pattern->col_connector,
72 input_block_size);
73 } else {
74 new_input_distribution = Paso_Distribution_getReference(pattern->input_distribution);
75 new_col_connector = Connector_getReference(pattern->col_connector);
76 }
77
78 if (Esys_noError()) {
79 out = new SystemMatrixPattern(type, new_output_distribution,
80 new_input_distribution,
81 new_mainPattern,
82 new_col_couplePattern,
83 new_row_couplePattern,
84 new_col_connector,
85 new_row_connector);
86 }
87 Pattern_free(new_mainPattern);
88 Pattern_free(new_col_couplePattern);
89 Pattern_free(new_row_couplePattern);
90 Paso_Distribution_free(new_output_distribution);
91 Paso_Distribution_free(new_input_distribution);
92 Connector_free(new_row_connector);
93 Connector_free(new_col_connector);
94 }
95
96 if (Esys_noError()) {
97 return out;
98 } else {
99 SystemMatrixPattern_free(out);
100 return NULL;
101 }
102 }
103
104 } // namespace paso
105

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26