OOFEM 3.0
Loading...
Searching...
No Matches
fetiboundarydofman.C
Go to the documentation of this file.
1/*
2 *
3 * ##### ##### ###### ###### ### ###
4 * ## ## ## ## ## ## ## ### ##
5 * ## ## ## ## #### #### ## # ##
6 * ## ## ## ## ## ## ## ##
7 * ## ## ## ## ## ## ## ##
8 * ##### ##### ## ###### ## ##
9 *
10 *
11 * OOFEM : Object Oriented Finite Element Code
12 *
13 * Copyright (C) 1993 - 2025 Borek Patzak
14 *
15 *
16 *
17 * Czech Technical University, Faculty of Civil Engineering,
18 * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19 *
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License as published by the Free Software Foundation; either
23 * version 2.1 of the License, or (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public
31 * License along with this library; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 */
34
36#include "error.h"
37
38using namespace std;
39
40
41namespace oofem {
42FETIBoundaryDofManager :: FETIBoundaryDofManager() : partitions(), codeNumbers()
43{
44 globalNumber = 0;
46 ndofs = 0;
47}
48
49FETIBoundaryDofManager :: FETIBoundaryDofManager(int num, int part, int ndof) : partitions(part), codeNumbers(part * ndof)
50{
51 globalNumber = num;
52 numberOfPartitions = part;
53 ndofs = ndof;
54}
55
56
57
58FETIBoundaryDofManager :: FETIBoundaryDofManager(const FETIBoundaryDofManager &src)
59{
62 ndofs = src.ndofs;
66}
67
68
69void
70FETIBoundaryDofManager :: addPartition(int partitionNumber)
71{
72 IntArray partitionToAdd(1);
73
74 partitionToAdd.at(1) = partitionNumber;
75 partitions.followedBy(partitionToAdd);
76 if ( numberOfPartitions != 0 ) {
77 if ( partitionNumber < referencePartition ) {
78 referencePartition = partitionNumber;
79 }
80 } else {
81 referencePartition = partitionNumber;
82 }
83
85}
86
87int
88FETIBoundaryDofManager :: setCodeNumbers(int &equationCounter)
89{
90 int i, size;
91
92 this->codeNumbers.resize( ( size = ( numberOfPartitions - 1 ) * ndofs ) );
93 for ( i = 1; i <= size; i++ ) {
94 codeNumbers.at(i) = ++equationCounter;
95 }
96
97 return equationCounter;
98}
99
100
101int
102FETIBoundaryDofManager :: giveCodeNumber(int partition_num, int dof_num)
103{
104 int indx = 0, i;
105 for ( i = 1; i <= numberOfPartitions; i++ ) {
106 if ( partitions.at(i) != referencePartition ) {
107 indx++;
108 }
109
110 if ( partitions.at(i) == partition_num ) {
111 break;
112 }
113 }
114
115 if ( ( indx == 0 ) || ( partition_num == referencePartition ) ) {
116 return 0;
117 }
118
119 if ( ( dof_num < 1 ) || ( dof_num > ndofs ) ) {
120 OOFEM_ERROR("bad dof_num requested");
121 }
122
123 return codeNumbers.at( ( indx - 1 ) * ndofs + dof_num );
124}
125
126int
127FETIBoundaryDofManager :: giveCompleteLocationArray(int rank, IntArray &locationArray)
128{
129 int indx = 0, i;
130 for ( i = 1; i <= numberOfPartitions; i++ ) {
131 if ( partitions.at(i) != referencePartition ) {
132 indx++;
133 }
134
135 if ( partitions.at(i) == rank ) {
136 break;
137 }
138 }
139
140 if ( ( indx == 0 ) || ( rank == referencePartition ) ) {
141 return 0;
142 }
143
144 locationArray.resize(ndofs);
145 for ( i = 1; i <= ndofs; i++ ) {
146 locationArray.at(i) = codeNumbers.at( ( indx - 1 ) * ndofs + i );
147 }
148
149 return 1;
150}
151} // end namespace oofem
int ndofs
Number of nonprescribed dofs, i.e, those, for which equation is necessary.
IntArray partitions
List of partitions sharing dof manager.
int globalNumber
Associated global number of dofManager.
int numberOfPartitions
Total number of partitions sharing receiver.
void resize(int n)
Definition intarray.C:73
int & at(std::size_t i)
Definition intarray.h:104
#define OOFEM_ERROR(...)
Definition error.h:79

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011