5 #include "GaudiKernel/StatusCode.h"
46 , m_pathbin(
v.m_pathbin)
47 , m_pathtxt(
v.m_pathtxt)
62 throw std::range_error(
"AlVec Assignment: size does not match!" );
83 if (
this==&
v)
return *
this;
86 throw std::range_error(
"AlVec Assignment: size does not match!" );
97 throw std::range_error(
"operator+: vectors size does not match!" );
113 throw std::range_error(
"operator+=: vectors size does not match!" );
126 throw std::range_error(
"operator-: vectors size does not match!" );
142 throw std::range_error(
"operator+=: vectors size does not match!" );
156 throw std::range_error(
"scalar product: vectors size does not match!" );
169 throw std::range_error(
"Left hand vector-matrix multiplication: size does not match!" );
174 for (
int i=0;
i<
m.ncol();
i++) {
183 throw std::range_error(
"Left hand vector-matrix multiplication: size does not match!" );
220 if ( Nnew>=0 && Nnew !=
m_size ) {
241 if(start<m_size && index>=0){
273 throw std::range_error(
"Vector of indices larger than matrix size." );
278 for (
int i=0;
i<
n-1;
i++)
279 for (
int j=
i+1; j<
n; j++)
287 for (
int i=0;
i<
n;
i++) {
290 throw std::out_of_range(
"AlVec::RemoveElements: Index goes beyond matrix " );
316 std::map<int,unsigned long long> moduleIndexMap,
float version)
318 std::ofstream outvec;
325 return StatusCode::FAILURE;
326 outvec.write((
char*)&io_size,
sizeof (io_size));
333 return StatusCode::FAILURE;
334 outvec.setf(std::ios::fixed);
335 outvec.setf(std::ios::showpoint);
337 outvec <<
"DoF: " << std::setw(6) <<
m_size << std::endl;
338 outvec <<
"scale: " << std::setw(18) <<
scale << std::endl;
339 outvec <<
"AlVec version: " << std::setw(6) <<
version << std::endl;
347 itcod=moduleIndexMap.find(
i/6);
348 if (itcod != moduleIndexMap.end()) {
349 ielem = (itcod->second);
355 outvec.write((
char*)&(ielem),
sizeof (ielem));
356 outvec.write((
char*)&(velem),
sizeof (velem));
359 outvec << std::setw(20) << ielem << std::setw(18) << velem << std::endl;
362 return StatusCode::SUCCESS;
367 std::map<int,unsigned long long> moduleIndexMap,
float version)
369 std::ofstream outvec;
398 if (
sc!=StatusCode::SUCCESS)
return StatusCode::FAILURE;
405 itcod=moduleIndexMap.find(
i);
406 if (itcod != moduleIndexMap.end())
407 ielem = (itcod->second);
412 outvec.write((
char*)&(ielem),
sizeof (ielem));
413 outvec.write((
char*)&(velem),
sizeof (velem));
416 outvec << std::setw(20) << ielem << std::setw(18) << velem << std::endl;
419 return StatusCode::SUCCESS;
424 std::map<int,std::string> moduleNameMap,
float version)
426 std::ofstream outvec;
429 if (
sc!=StatusCode::SUCCESS)
return StatusCode::FAILURE;
436 itcod=moduleNameMap.find(
i);
437 if (itcod != moduleNameMap.end()) {
438 elem = (itcod->second);
444 std::cout<<
"can't write module name in binary output!"<<std::endl;
445 return StatusCode::FAILURE;
448 outvec << std::setw(20) << elem << std::setw(18) << velem << std::endl;
451 return StatusCode::SUCCESS;
456 float version, std::ofstream& outvec)
463 return StatusCode::FAILURE;
464 outvec.write((
char*)&io_size,
sizeof (io_size));
472 return StatusCode::FAILURE;
473 outvec.setf(std::ios::fixed);
474 outvec.setf(std::ios::showpoint);
476 outvec <<
"DoF: " << std::setw(6) <<
m_size << std::endl;
477 outvec <<
"scale: " << std::setw(18) <<
scale << std::endl;
478 outvec <<
"AlVec version: " << std::setw(6) <<
version << std::endl;
480 return StatusCode::SUCCESS;
485 std::map<int,unsigned long long> &modmap,
float &
version)
487 bool StdUnits =
true;
490 return StatusCode::FAILURE;
496 return StatusCode::FAILURE;
500 invec.read((
char*)&vsiz,
sizeof (vsiz));
517 invec.read((
char*)&ielem,
sizeof (ielem));
520 invec.read((
char*)&velem,
sizeof (velem));
528 return StatusCode::SUCCESS;
533 std::ifstream invec((
filename).c_str(), std::ios::binary);
535 return StatusCode::FAILURE;
538 invec.read((
char*)&vsiz,
sizeof (vsiz));
556 return StatusCode::SUCCESS;
561 std::map<int,unsigned long long> &modmap,
float &
version)
564 bool StdUnits =
true;
567 return StatusCode::FAILURE;
572 return StatusCode::FAILURE;
575 invec.read((
char*)&vsiz,
sizeof (vsiz));
594 invec.read((
char*)&ielem,
sizeof (ielem));
597 invec.read((
char*)&velem,
sizeof (velem));
605 return StatusCode::SUCCESS;
610 std::map<int,unsigned long long> &modmap,
float &
version)
614 return StatusCode::FAILURE;
617 invec.read((
char*)&vsiz,
sizeof (vsiz));
632 invec.read((
char*)&ielem,
sizeof (ielem));
635 invec.read((
char*)&velem,
sizeof (velem));
643 return StatusCode::SUCCESS;
648 std::ifstream eigenvec(
filename.c_str(), std::ios::binary);
650 return StatusCode::FAILURE;
653 eigenvec.read((
char*)&vsiz,
sizeof (vsiz));
658 eigenvec.read((
char*)&velem,
sizeof (velem));
664 return StatusCode::SUCCESS;
670 std::ofstream outvec;
677 return StatusCode::FAILURE;
679 outvec.write((
char*)&io_size,
sizeof (io_size));
685 return StatusCode::FAILURE;
687 outvec.setf(std::ios::fixed);
688 outvec.setf(std::ios::showpoint);
690 outvec <<
"AlVec::DoF: " << std::setw(6) <<
m_size << std::endl;
702 outvec.write((
char*)&(velem),
sizeof (velem));
704 outvec << std::setw(10) <<
i << std::setw(18) << velem << std::endl;
707 return StatusCode::SUCCESS;