OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
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 - 2013 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 
35 #include "../sm/FETISolver/fetiboundarydofman.h"
36 #include "error.h"
37 
38 using namespace std;
39 
40 
41 namespace oofem {
42 FETIBoundaryDofManager :: FETIBoundaryDofManager() : partitions(), codeNumbers()
43 {
44  globalNumber = 0;
46  ndofs = 0;
47 }
48 
49 FETIBoundaryDofManager :: 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 
59 {
62  ndofs = src.ndofs;
64  partitions = src.partitions;
66 }
67 
68 
69 void
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 
87 int
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 
101 int
102 FETIBoundaryDofManager :: 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 
126 int
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
IntArray partitions
List of partitions sharing dof manager.
int giveCodeNumber(int partition_num, int dof_num)
Returns code number corresponding to partition number partition_num and to dof_num-th DOF...
int globalNumber
Associated global number of dofManager.
void addPartition(int partitionNumber)
Adds partition to list of partitions, sharing this dof manager.
int giveCompleteLocationArray(int rank, IntArray &locationArray)
Returns code numbers for all DOFs associated with shared partition.
Class implementing an array of integers.
Definition: intarray.h:61
int & at(int i)
Coefficient access function.
Definition: intarray.h:103
int referencePartition
Reference partition is partition to which other partitions sharing the dof manager are linked using l...
#define OOFEM_ERROR(...)
Definition: error.h:61
void resize(int n)
Checks size of receiver towards requested bounds.
Definition: intarray.C:124
int ndofs
Number of nonprescribed dofs, i.e, those, for which equation is necessary.
Represent the abstraction for DOF manager.
IntArray codeNumbers
Contains code numbers for each linked partition for each DOF (ndofs*(numberOfPartitions-1) DOFs)...
void followedBy(const IntArray &b, int allocChunk=0)
Appends array b at the end of receiver.
Definition: intarray.C:145
int numberOfPartitions
Total number of partitions sharing receiver.
the oofem namespace is to define a context or scope in which all oofem names are defined.
int setCodeNumbers(int &equationCounter)
Associates the equation numbers to particular DOFs.

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:28 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011