source: ThirdParty/mpqc_open/src/lib/math/scmat/blocked.cc@ 1513599

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction Subpackage_levmar Subpackage_vmg ThirdParty_MPQC_rebuilt_buildsystem TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since 1513599 was 860145, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit '0b990dfaa8c6007a996d030163a25f7f5fc8a7e7' as 'ThirdParty/mpqc_open'

  • Property mode set to 100644
File size: 4.7 KB
Line 
1//
2// blocked.cc
3//
4// Copyright (C) 1996 Limit Point Systems, Inc.
5//
6// Author: Curtis Janssen <cljanss@limitpt.com>
7// Maintainer: LPS
8//
9// This file is part of the SC Toolkit.
10//
11// The SC Toolkit is free software; you can redistribute it and/or modify
12// it under the terms of the GNU Library General Public License as published by
13// the Free Software Foundation; either version 2, or (at your option)
14// any later version.
15//
16// The SC Toolkit is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU Library General Public License for more details.
20//
21// You should have received a copy of the GNU Library General Public License
22// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24//
25// The U.S. Government is granted a limited license as per AL 91-7.
26//
27
28#ifdef __GNUC__
29#pragma implementation
30#endif
31
32#include <math.h>
33
34#include <util/misc/formio.h>
35#include <util/keyval/keyval.h>
36#include <math/scmat/blocked.h>
37#include <math/scmat/cmatrix.h>
38#include <math/scmat/elemop.h>
39
40using namespace std;
41using namespace sc;
42
43/////////////////////////////////////////////////////////////////////////////
44// BlockedSCMatrixKit member functions
45
46static ClassDesc BlockedSCMatrixKit_cd(
47 typeid(BlockedSCMatrixKit),"BlockedSCMatrixKit",1,"public SCMatrixKit",
48 0, create<BlockedSCMatrixKit>, 0);
49
50BlockedSCMatrixKit::BlockedSCMatrixKit(const Ref<SCMatrixKit>&subkit):
51 subkit_(subkit)
52{
53}
54
55BlockedSCMatrixKit::BlockedSCMatrixKit(const Ref<KeyVal>& keyval):
56 SCMatrixKit(keyval)
57{
58 subkit_ << keyval->describedclassvalue("subkit");
59}
60
61BlockedSCMatrixKit::~BlockedSCMatrixKit()
62{
63}
64
65SCMatrix*
66BlockedSCMatrixKit::matrix(const RefSCDimension&d1, const RefSCDimension&d2)
67{
68 int i;
69 for (i=0; i<d1->blocks()->nblock(); i++) {
70 if (d1->blocks()->subdim(i).null()) {
71 ExEnv::errn() << indent
72 << "BlockedSCMatrixKit: given a dim without subdim info"
73 << endl;
74 abort();
75 }
76 }
77 for (i=0; i<d2->blocks()->nblock(); i++) {
78 if (d2->blocks()->subdim(i).null()) {
79 ExEnv::errn() << indent
80 << "BlockedSCMatrixKit: given a dim without subdim info"
81 << endl;
82 abort();
83 }
84 }
85 return new BlockedSCMatrix(d1,d2,this);
86}
87
88SymmSCMatrix*
89BlockedSCMatrixKit::symmmatrix(const RefSCDimension&d)
90{
91 for (int i=0; i<d->blocks()->nblock(); i++) {
92 if (d->blocks()->subdim(i).null()) {
93 ExEnv::errn() << indent
94 << "BlockedSCMatrixKit: given a dim without subdim info"
95 << endl;
96 abort();
97 }
98 }
99 return new BlockedSymmSCMatrix(d,this);
100}
101
102DiagSCMatrix*
103BlockedSCMatrixKit::diagmatrix(const RefSCDimension&d)
104{
105 for (int i=0; i<d->blocks()->nblock(); i++) {
106 if (d->blocks()->subdim(i).null()) {
107 ExEnv::errn() << indent
108 << "BlockedSCMatrixKit: given a dim without subdim info"
109 << endl;
110 abort();
111 }
112 }
113 return new BlockedDiagSCMatrix(d,this);
114}
115
116SCVector*
117BlockedSCMatrixKit::vector(const RefSCDimension&d)
118{
119 for (int i=0; i<d->blocks()->nblock(); i++) {
120 if (d->blocks()->subdim(i).null()) {
121 ExEnv::errn() << indent
122 << "BlockedSCMatrixKit: given a dim without subdim info"
123 << endl;
124 abort();
125 }
126 }
127 return new BlockedSCVector(d,this);
128}
129
130/////////////////////////////////////////////////////////////////////////////
131
132static ClassDesc BlockedSCElementOp_cd(
133 typeid(BlockedSCElementOp),"BlockedSCElementOp",1,"public SCElementOp",
134 0, 0, 0);
135
136BlockedSCElementOp::BlockedSCElementOp()
137{
138 current_block_=0;
139}
140
141void
142BlockedSCElementOp::working_on(int b)
143{
144 current_block_ = b;
145}
146
147int
148BlockedSCElementOp::current_block() const
149{
150 return current_block_;
151}
152
153static ClassDesc BlockedSCElementOp2_cd(
154 typeid(BlockedSCElementOp2),"BlockedSCElementOp2",1,"public SCElementOp2",
155 0, 0, 0);
156
157BlockedSCElementOp2::BlockedSCElementOp2()
158{
159 current_block_=0;
160}
161
162void
163BlockedSCElementOp2::working_on(int b)
164{
165 current_block_ = b;
166}
167
168int
169BlockedSCElementOp2::current_block() const
170{
171 return current_block_;
172}
173
174static ClassDesc BlockedSCElementOp3_cd(
175 typeid(BlockedSCElementOp3),"BlockedSCElementOp3",1,"public SCElementOp3",
176 0, 0, 0);
177
178BlockedSCElementOp3::BlockedSCElementOp3()
179{
180 current_block_=0;
181}
182
183void
184BlockedSCElementOp3::working_on(int b)
185{
186 current_block_ = b;
187}
188
189int
190BlockedSCElementOp3::current_block() const
191{
192 return current_block_;
193}
194
195/////////////////////////////////////////////////////////////////////////////
196
197// Local Variables:
198// mode: c++
199// c-file-style: "CLJ"
200// End:
Note: See TracBrowser for help on using the repository browser.