39 FactoryMonitor m(*
this,
"Structural acoustics nullspace factory", currentLevel);
40 RCP<MultiVector> nullspace;
44 GetOStream(
Runtime1) <<
"Use user-given rigid body modes " << nspName_ <<
": nullspace dimension=" << nullspace->getNumVectors() <<
" nullspace length=" << nullspace->getGlobalLength() << std::endl;
46 RCP<Matrix> A = Get<RCP<Matrix> >(currentLevel,
"A");
47 RCP<MultiVector> Coords = Get<RCP<MultiVector> >(currentLevel,
"Coordinates");
48 GetOStream(
Runtime1) <<
"Generating nullspace for structural acoustics: dimension = " << numPDEs_ << std::endl;
49 RCP<const Map> xmap = A->getDomainMap();
50 nullspace = MultiVectorFactory::Build(xmap, 6);
52 nullspace->putScalar(zero);
53 ArrayRCP<Scalar> xnodes, ynodes, znodes;
55 ArrayRCP<Scalar> nsValues0, nsValues1, nsValues2, nsValues3, nsValues4, nsValues5;
56 int nDOFs = xmap->getLocalNumElements();
57 xnodes = Coords->getDataNonConst(0);
58 ynodes = Coords->getDataNonConst(1);
59 znodes = Coords->getDataNonConst(2);
60 cx = Coords->getVector(0)->meanValue();
61 cy = Coords->getVector(1)->meanValue();
62 cz = Coords->getVector(2)->meanValue();
63 nsValues0 = nullspace->getDataNonConst(0);
64 nsValues1 = nullspace->getDataNonConst(1);
65 nsValues2 = nullspace->getDataNonConst(2);
66 nsValues3 = nullspace->getDataNonConst(3);
67 nsValues4 = nullspace->getDataNonConst(4);
68 nsValues5 = nullspace->getDataNonConst(5);
69 for (
int j = 0; j < nDOFs; j += numPDEs_) {
71 if (xmap->getGlobalElement(j) >= lastAcousticDOF_) {
72 Scalar xdiff = xnodes[j] - cx;
73 Scalar ydiff = ynodes[j] - cy;
74 Scalar zdiff = znodes[j] - cz;
76 nsValues0[j + 0] = one;
77 nsValues1[j + 1] = one;
78 nsValues2[j + 2] = one;
80 nsValues3[j + 0] = -ydiff;
81 nsValues3[j + 1] = xdiff;
83 nsValues4[j + 1] = -zdiff;
84 nsValues4[j + 2] = ydiff;
86 nsValues5[j + 0] = zdiff;
87 nsValues5[j + 2] = -xdiff;
90 nsValues0[j + 0] = one;
92 nsValues1[j + 1] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
93 nsValues1[j + 2] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
94 nsValues2[j + 1] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
95 nsValues2[j + 2] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
96 nsValues3[j + 1] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
97 nsValues3[j + 2] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
98 nsValues4[j + 1] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
99 nsValues4[j + 2] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
100 nsValues5[j + 1] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
101 nsValues5[j + 2] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
106 nullspace = currentLevel.
Get<RCP<MultiVector> >(
"Nullspace", GetFactory(nspName_).get());
108 Set(currentLevel,
"Nullspace", nullspace);
113 GetOStream(
Runtime1) <<
"Generating nullspace for structural acoustics: dimension = " << numPDEs_ << std::endl;
114 RCP<const Map> xmap = A->getDomainMap();
115 nullspace = MultiVectorFactory::Build(xmap, 6);
117 nullspace->putScalar(zero);
118 ArrayRCP<Scalar> xnodes, ynodes, znodes;
120 ArrayRCP<Scalar> nsValues0, nsValues1, nsValues2, nsValues3, nsValues4, nsValues5;
121 int nDOFs = xmap->getLocalNumElements();
122 xnodes = Coords->getDataNonConst(0);
123 ynodes = Coords->getDataNonConst(1);
124 znodes = Coords->getDataNonConst(2);
125 cx = Coords->getVector(0)->meanValue();
126 cy = Coords->getVector(1)->meanValue();
127 cz = Coords->getVector(2)->meanValue();
128 nsValues0 = nullspace->getDataNonConst(0);
129 nsValues1 = nullspace->getDataNonConst(1);
130 nsValues2 = nullspace->getDataNonConst(2);
131 nsValues3 = nullspace->getDataNonConst(3);
132 nsValues4 = nullspace->getDataNonConst(4);
133 nsValues5 = nullspace->getDataNonConst(5);
134 for (
int j = 0; j < nDOFs; j += numPDEs_) {
136 if (xmap->getGlobalElement(j) >= lastAcousticDOF_) {
137 Scalar xdiff = xnodes[j] - cx;
138 Scalar ydiff = ynodes[j] - cy;
139 Scalar zdiff = znodes[j] - cz;
141 nsValues0[j + 0] = one;
142 nsValues1[j + 1] = one;
143 nsValues2[j + 2] = one;
145 nsValues3[j + 0] = -ydiff;
146 nsValues3[j + 1] = xdiff;
148 nsValues4[j + 1] = -zdiff;
149 nsValues4[j + 2] = ydiff;
151 nsValues5[j + 0] = zdiff;
152 nsValues5[j + 2] = -xdiff;
155 nsValues0[j + 0] = one;
157 nsValues1[j + 1] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
158 nsValues1[j + 2] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
159 nsValues2[j + 1] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
160 nsValues2[j + 2] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
161 nsValues3[j + 1] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
162 nsValues3[j + 2] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
163 nsValues4[j + 1] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
164 nsValues4[j + 2] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
165 nsValues5[j + 1] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
166 nsValues5[j + 2] = (
Scalar)(((
double)rand()) / ((
double)RAND_MAX));
void DeclareInput(const std::string &ename, const FactoryBase *factory, const FactoryBase *requestedBy=NoFactory::get())
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput()
T & Get(const std::string &ename, const FactoryBase *factory=NoFactory::get())
Get data without decrementing associated storage counter (i.e., read-only access)....