FEI Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
base
fei_LinearSystem.cpp
Go to the documentation of this file.
1
/*--------------------------------------------------------------------*/
2
/* Copyright 2005 Sandia Corporation. */
3
/* Under the terms of Contract DE-AC04-94AL85000, there is a */
4
/* non-exclusive license for use of this work by or on behalf */
5
/* of the U.S. Government. Export of this program may require */
6
/* a license from the United States Government. */
7
/*--------------------------------------------------------------------*/
8
9
#include <
fei_macros.hpp
>
10
11
#include <
fei_MatrixGraph.hpp
>
12
#include <
fei_LinearSystem.hpp
>
13
#include <
snl_fei_LinearSystem_General.hpp
>
14
#include <
snl_fei_Utils.hpp
>
15
16
//----------------------------------------------------------------------------
17
fei::LinearSystem::LinearSystem
(
fei::SharedPtr<fei::MatrixGraph>
& matrixGraph)
18
:
matrix_
(),
19
soln_
(),
20
rhs_
(),
21
matrixGraph_
(matrixGraph),
22
dbcManager_
(NULL)
23
{
24
}
25
26
//----------------------------------------------------------------------------
27
fei::LinearSystem::~LinearSystem
()
28
{
29
delete
dbcManager_
;
30
31
for
(
unsigned
i=0; i<
attributeNames_
.size(); ++i) {
32
delete
[]
attributeNames_
[i];
33
}
34
}
35
36
//----------------------------------------------------------------------------
37
fei::SharedPtr<fei::LinearSystem>
38
fei::LinearSystem::Factory::createLinearSystem
(
fei::SharedPtr<fei::MatrixGraph>
& matrixGraph)
39
{
40
fei::SharedPtr<fei::LinearSystem>
41
linsys(
new
snl_fei::LinearSystem_General
(matrixGraph));
42
43
return
(linsys);
44
}
45
46
//----------------------------------------------------------------------------
47
void
fei::LinearSystem::setMatrix
(
fei::SharedPtr<fei::Matrix>
& matrix)
48
{
49
matrix_
= matrix;
50
}
51
52
//----------------------------------------------------------------------------
53
int
fei::LinearSystem::putAttribute
(
const
char
* name,
54
void
* attribute)
55
{
56
snl_fei::storeNamedAttribute
(name, attribute,
57
attributeNames_
,
attributes_
);
58
return
(0);
59
}
60
61
//----------------------------------------------------------------------------
62
int
fei::LinearSystem::getAttribute
(
const
char
* name,
63
void
*& attribute)
64
{
65
attribute =
snl_fei::retrieveNamedAttribute
(name,
attributeNames_
,
attributes_
);
66
return
(attribute==NULL ? -1 : 0);
67
}
68
69
//----------------------------------------------------------------------------
70
int
fei::LinearSystem::loadEssentialBCs
(
int
numIDs,
71
const
int
* IDs,
72
int
idType,
73
int
fieldID,
74
int
offsetIntoField,
75
const
double
* prescribedValues)
76
{
77
if
(
dbcManager_
== NULL) {
78
dbcManager_
=
new
fei::DirichletBCManager
(
matrixGraph_
->getRowSpace());
79
}
80
81
try
{
82
dbcManager_
->addBCRecords(numIDs, idType, fieldID, offsetIntoField,
83
IDs, prescribedValues);
84
}
85
catch
(std::runtime_error& exc) {
86
fei::console_out
() << exc.what()<<
FEI_ENDL
;
87
return
(-1);
88
}
89
90
return
(0);
91
}
92
93
//----------------------------------------------------------------------------
94
int
fei::LinearSystem::loadEssentialBCs
(
int
numIDs,
95
const
int
* IDs,
96
int
idType,
97
int
fieldID,
98
const
int
* offsetsIntoField,
99
const
double
* prescribedValues)
100
{
101
if
(
dbcManager_
== NULL) {
102
dbcManager_
=
new
fei::DirichletBCManager
(
matrixGraph_
->getRowSpace());
103
}
104
105
try
{
106
dbcManager_
->addBCRecords(numIDs, idType, fieldID, IDs, offsetsIntoField,
107
prescribedValues);
108
}
109
catch
(std::runtime_error& exc) {
110
fei::console_out
() << exc.what()<<
FEI_ENDL
;
111
return
(-1);
112
}
113
114
return
(0);
115
}
116
fei::DirichletBCManager
Definition
fei_DirichletBCManager.hpp:25
fei::LinearSystem::Factory::createLinearSystem
virtual fei::SharedPtr< fei::LinearSystem > createLinearSystem(fei::SharedPtr< fei::MatrixGraph > &matrixGraph)
Definition
fei_LinearSystem.cpp:38
fei::LinearSystem::matrixGraph_
fei::SharedPtr< fei::MatrixGraph > matrixGraph_
Definition
fei_LinearSystem.hpp:209
fei::LinearSystem::matrix_
fei::SharedPtr< fei::Matrix > matrix_
Definition
fei_LinearSystem.hpp:205
fei::LinearSystem::loadEssentialBCs
virtual int loadEssentialBCs(int numIDs, const int *IDs, int idType, int fieldID, int offsetIntoField, const double *prescribedValues)
Definition
fei_LinearSystem.cpp:70
fei::LinearSystem::attributes_
std::vector< void * > attributes_
Definition
fei_LinearSystem.hpp:213
fei::LinearSystem::LinearSystem
LinearSystem(fei::SharedPtr< fei::MatrixGraph > &matrixGraph)
Definition
fei_LinearSystem.cpp:17
fei::LinearSystem::soln_
fei::SharedPtr< fei::Vector > soln_
Definition
fei_LinearSystem.hpp:206
fei::LinearSystem::dbcManager_
fei::DirichletBCManager * dbcManager_
Definition
fei_LinearSystem.hpp:210
fei::LinearSystem::~LinearSystem
virtual ~LinearSystem()
Definition
fei_LinearSystem.cpp:27
fei::LinearSystem::attributeNames_
std::vector< char * > attributeNames_
Definition
fei_LinearSystem.hpp:212
fei::LinearSystem::rhs_
fei::SharedPtr< fei::Vector > rhs_
Definition
fei_LinearSystem.hpp:207
fei::LinearSystem::putAttribute
virtual int putAttribute(const char *name, void *attribute)
Definition
fei_LinearSystem.cpp:53
fei::LinearSystem::getAttribute
virtual int getAttribute(const char *name, void *&attribute)
Definition
fei_LinearSystem.cpp:62
fei::LinearSystem::setMatrix
virtual void setMatrix(fei::SharedPtr< fei::Matrix > &matrix)
Definition
fei_LinearSystem.cpp:47
fei::SharedPtr
Definition
fei_SharedPtr.hpp:65
snl_fei::LinearSystem_General
Definition
snl_fei_LinearSystem_General.hpp:28
fei_LinearSystem.hpp
fei_MatrixGraph.hpp
FEI_ENDL
#define FEI_ENDL
Definition
fei_iostream.hpp:34
fei_macros.hpp
fei::console_out
std::ostream & console_out()
Definition
fei_console_ostream.cpp:26
snl_fei::storeNamedAttribute
int storeNamedAttribute(const char *name, void *attribute, std::vector< char * > &attributeNames, std::vector< void * > &attributes)
Definition
snl_fei_Utils.cpp:220
snl_fei::retrieveNamedAttribute
void * retrieveNamedAttribute(const char *name, std::vector< char * > &attributeNames, std::vector< void * > &attributes)
Definition
snl_fei_Utils.cpp:244
snl_fei_LinearSystem_General.hpp
snl_fei_Utils.hpp
Generated by
1.17.0