Commit 47600967 authored by TOUZE Francois's avatar TOUZE Francois
Browse files

Merge branch 'develop' of gitlab.in2p3.fr:PSPA/PSPA into develop

parents f6ccc021 a7f5310f
Pipeline #123387 failed with stage
in 18 seconds
# Node.js
frontend/node_modules
frontend/package-lock.json
frontend/src/utils/constants/params-servers.js
# macOs
.DS_Store
backend/pspa/v0/Darwin
backend/pspa/v0/cmt/cleanup.csh
backend/pspa/v0/cmt/cleanup.sh
backend/pspa/v0/cmt/setup.csh
backend/pspa/v0/cmt/setup.sh
# controller
controller/pspa.cpython
controller/modules/*.o
controller/modules/*.so*
controller/modules/pspacode.cpp
controller/modules/pspaplot.cpp
controller/cythonOS/*.o
controller/cythonOS/*.so
controller/cythonOS/pypspaclass.cpp
controller/cythonOS/pypspaplots.cpp
controller/venv
controller/__pycache__
controller/authenticate/__pycache__
controller/authenticate/*.sqlite
controller/authenticate/*.pyc
# softwares
softwares/*
softwares/madx64
softwares/elegant
softwares/astra
softwares/sddsprintout
softwares/generator
softwares/betabatch
softwares/sddsprocess
softwares/parmela
# Logs
logs
*.log
npm-debug.log*
image: ubuntu:18.04
stages:
- deploy
deploy_dev:
only:
- develop
variables:
PSPA_PATH: "/usr/local/PSPA"
PSPA_CONTROLLER_PATH: $PSPA_PATH/controller
PSPA_BACKEND_PATH: $PSPA_PATH/backend
PSPA_BACKEND_CMT_PATH: $PSPA_PATH/backend/pspa/v0/cmt
before_script:
- apt-get update
- 'which ssh-agent || ( apt-get install -qq openssh-client )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIV_KEYS_PSPA")
- mkdir -p ~/.ssh
- echo $SSH_KEYS_PSPA >> cat ~/.ssh/id_rsa.pub
- ssh -o StrictHostKeyChecking=no centos@134.158.74.154 "cd $PSPA_PATH; git pull git@gitlab.in2p3.fr:PSPA/PSPA.git develop"
stage: deploy
script:
- ssh -o StrictHostKeyChecking=no centos@134.158.74.154
"export CMTPATH=$PSPA_BACKEND_PATH;
export CMTROOT=/usr/local/CMT/v1r26p20160527;
cd $PSPA_BACKEND_CMT_PATH;
/usr/local/CMT/v1r26p20160527/Linux-x86_64/cmt config;
source setup.sh;
/usr/local/CMT/v1r26p20160527/Linux-x86_64/cmt make;
cd $PSPA_CONTROLLER_PATH;
sudo pip3 install -r requirements.txt;
cd cythonUX;
python3 pspaclass.py build_ext --inplace;
python3 pspaplots.py build_ext --inplace;
cd $PSPA_PATH;
/bin/bash stop_pspa.sh;"
deploy_master:
only:
- master
variables:
PSPA_PATH: "/usr/local/PSPA_auth"
PSPA_CONTROLLER_PATH: $PSPA_PATH/controller
PSPA_BACKEND_PATH: $PSPA_PATH/backend
PSPA_BACKEND_CMT_PATH: $PSPA_PATH/backend/pspa/v0/cmt
before_script:
- apt-get update
- 'which ssh-agent || ( apt-get install -qq openssh-client )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIV_KEYS_PSPA")
- mkdir -p ~/.ssh
- echo $SSH_KEYS_PSPA >> cat ~/.ssh/id_rsa.pub
- ssh -o StrictHostKeyChecking=no centos@134.158.74.148 "cd /usr/local/PSPA; git pull git@gitlab.in2p3.fr:PSPA/PSPA.git master"
- ssh -o StrictHostKeyChecking=no centos@134.158.74.148 "alias cmt='/usr/local/CMT/v1r26p20160527/Linux-x86_64/cmt'"
stage: deploy
script:
- ssh -o StrictHostKeyChecking=no centos@134.158.4.148
"export CMTPATH=$PSPA_BACKEND_PATH;
cd PSPA_BACKEND_CMT_PATH;
/usr/local/CMT/v1r26p20160527/Linux-x86_64/cmt config;
source setup.sh;
/usr/local/CMT/v1r26p20160527/Linux-x86_64/cmt make;
cd $PSPA_CONTROLLER_PATH;
source venv/bin/activate;
pip install -r requirements.txt;
cd cythonUX;
python pspaclass.py build_ext --inplace;
python pspaplots.py build_ext --inplace;
cd PSPA_PATH;
/bin/bash stop_pspa.sh"
if ( $?CMTROOT == 0 ) then
setenv CMTROOT /usr/local/CMT/v1r20p20090520
endif
source ${CMTROOT}/mgr/setup.csh
set tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`
if $status != 0 then
set tempfile=/tmp/cmt.$$
endif
${CMTROOT}/mgr/cmt cleanup -csh -pack=pspa -version=v0 -path=/Users/touze/Public/pspa.git/backend $* >${tempfile}; source ${tempfile}
/bin/rm -f ${tempfile}
if test "${CMTROOT}" = ""; then
CMTROOT=/usr/local/CMT/v1r20p20090520; export CMTROOT
fi
. ${CMTROOT}/mgr/setup.sh
tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`
if test ! $? = 0 ; then tempfile=/tmp/cmt.$$; fi
${CMTROOT}/mgr/cmt cleanup -sh -pack=pspa -version=v0 -path=/Users/touze/Public/pspa.git/backend $* >${tempfile}; . ${tempfile}
/bin/rm -f ${tempfile}
# echo "Setting pspa v0 in /Users/touze/Public/pspa.git/backend"
if ( $?CMTROOT == 0 ) then
setenv CMTROOT /usr/local/CMT/v1r20p20090520
endif
source ${CMTROOT}/mgr/setup.csh
set tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`
if $status != 0 then
set tempfile=/tmp/cmt.$$
endif
${CMTROOT}/mgr/cmt setup -csh -pack=pspa -version=v0 -path=/Users/touze/Public/pspa.git/backend -no_cleanup $* >${tempfile}; source ${tempfile}
/bin/rm -f ${tempfile}
# echo "Setting pspa v0 in /Users/touze/Public/pspa.git/backend"
if test "${CMTROOT}" = ""; then
CMTROOT=/usr/local/CMT/v1r20p20090520; export CMTROOT
fi
. ${CMTROOT}/mgr/setup.sh
tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`
if test ! $? = 0 ; then tempfile=/tmp/cmt.$$; fi
${CMTROOT}/mgr/cmt setup -sh -pack=pspa -version=v0 -path=/Users/touze/Public/pspa.git/backend -no_cleanup $* >${tempfile}; . ${tempfile}
/bin/rm -f ${tempfile}
......@@ -2,8 +2,9 @@
#define PHYSICALCONSTANTS_SEEN
#define ZGRAND 1.0e8
#define ZDISTCATH 1. // cm ! distance maximale à la cathode (supposee en z=0) pour
// prendre en compte la charge image, dans la charge d'espace
#define ZDISTCATH 1. // cm ! distance maximale à la cathode (supposee en z=0) pour prendre en compte la charge image, dans la charge d'espace
#define ELECTRONMASSE 9.1094e-31
#define ELECTRONCHARGE 1.60217653e-19
#define ELECTRONANOCOULOMB 1.60217653e-10
#define ELECTRONRADIUS 2.817940325e-13 // cm!
......
#include "bareParticle.h"
bareParticle::bareParticle(const TRIDVECTOR& pos , const TRIDVECTOR& bg)
{
position_ = pos;
betagamma_ = bg;
gamma_ = sqrt( 1.0 + betagamma_.norm2() );
}
bareParticle::bareParticle(bareParticle& bp)
{
position_ = bp.position_;
betagamma_ = bp.betagamma_;
gamma_ = bp.gamma_;
}
bareParticle::bareParticle(const bareParticle& bp)
{
position_ = bp.position_;
betagamma_ = bp.betagamma_;
gamma_ = bp.gamma_;
}
void bareParticle::resetDynamics(const bareParticle& bp)
{
position_ = bp.position_;
betagamma_ = bp.betagamma_;
gamma_ = bp.gamma_;
}
bareParticle& bareParticle::operator = (const bareParticle& bp)
{
position_ = bp.position_;
betagamma_ = bp.betagamma_;
gamma_ = bp.gamma_;
return *this;
}
const TRIDVECTOR& bareParticle::getReferenceToPosition() const
{
return position_;
}
TRIDVECTOR bareParticle::getPosition() const
{
return position_;
}
TRIDVECTOR& bareParticle::getReferenceToPosition()
{
return position_;
}
double bareParticle::getZ() const
{
return position_.getComponent(2);
}
#include "bareParticle.h"
bareParticle::bareParticle(const TRIDVECTOR& pos, const TRIDVECTOR& bg)
{
position_ = pos;
betagamma_= bg;
gamma_= sqrt(1.0 + betagamma_.norm2());
}
bareParticle::bareParticle(bareParticle& bp)
{
position_ = bp.position_;
betagamma_= bp.betagamma_;
gamma_= bp.gamma_;
}
bareParticle::bareParticle(const bareParticle& bp)
{
position_ = bp.position_;
betagamma_= bp.betagamma_;
gamma_= bp.gamma_;
}
void bareParticle::resetDynamics(const bareParticle& bp)
{
position_ = bp.position_;
betagamma_= bp.betagamma_;
gamma_= bp.gamma_;
}
bareParticle& bareParticle::operator = (const bareParticle& bp)
{
position_ = bp.position_;
betagamma_= bp.betagamma_;
gamma_= bp.gamma_;
return *this;
}
const TRIDVECTOR& bareParticle::getReferenceToPosition() const
{
return position_;
}
TRIDVECTOR bareParticle::getPosition() const
{
return position_;
}
TRIDVECTOR& bareParticle::getReferenceToPosition()
{
return position_;
}
double bareParticle::getZ() const
{
return position_.getComponent(2);
}
void bareParticle::setZ(double z)
{
position_.setComponent(2, z);
}
{
position_.setComponent(2, z);
}
void bareParticle::incrementZ( double dz)
{
position_.incrementComponent(2, dz);
}
{
position_.incrementComponent(2, dz);
}
void bareParticle::setX(double x)
{
position_.setComponent(0, x);
}
{
position_.setComponent(0, x);
}
double bareParticle::getRadius() const
{
double auxx = position_.getComponent(0);
double auxy = position_.getComponent(1);
return sqrt(auxx * auxx + auxy * auxy);
}
{
double auxx = position_.getComponent(0);
double auxy = position_.getComponent(1);
return sqrt(auxx * auxx + auxy * auxy);
}
TRIDVECTOR bareParticle::getBetaGamma() const
{
return betagamma_;
}
{
return betagamma_;
}
TRIDVECTOR& bareParticle::getReferenceToBetaGamma()
{
return betagamma_;
}
{
return betagamma_;
}
void bareParticle::setBetaGamma(const TRIDVECTOR& btg)
{
betagamma_ = btg;
gamma_ = sqrt( 1.0 + betagamma_.norm2() );
}
{
betagamma_ = btg;
gamma_ = sqrt( 1.0 + betagamma_.norm2() );
}
double bareParticle::getBetaz() const
{
return betagamma_.getComponent(2)/gamma_;
}
{
return betagamma_.getComponent(2)/gamma_;
}
double bareParticle::getGamma() const
{
return gamma_;
}
{
return gamma_;
}
string bareParticle::FileOutputFlow() const
{
ostringstream sortie;
sortie << position_.output_flow() << betagamma_.output_flow() << " " << gamma_;
return sortie.str();
}
{
ostringstream sortie;
sortie << position_.output_flow() << betagamma_.output_flow() << " " << gamma_;
return sortie.str();
}
bool bareParticle::FileInput( ifstream& ifs)
{
bool test = false;
if ( position_.input_flow(ifs) && betagamma_.input_flow(ifs) )
{
if ( ifs >> gamma_ )
{
test = true;
}
}
return test;
}
void bareParticle::imprimer() const
{
cout << " ---- impression particule nue ----- " << endl;
cout << " position : " << endl;
position_.print();
cout << " betas : " << endl;
TRIDVECTOR betas;
double fac = 1.0/gamma_;
betas = betagamma_ * fac;
betas.print();
cout << " gamma = " << gamma_ << endl;
}
{
bool test = false;
if ( position_.input_flow(ifs) && betagamma_.input_flow(ifs) )
{
if ( ifs >> gamma_ )
{
test = true;
}
}
return test;
}
void bareParticle::imprimer() const
{
cout << " ---- impression particule nue ----- " << endl;
cout << " position : " << endl;
position_.print();
cout << " betas : " << endl;
TRIDVECTOR betas;
double fac = 1.0/gamma_;
betas = betagamma_ * fac;
betas.print();
cout << " gamma = " << gamma_ << endl;
}
#include "beam2Moments.h"
#include <sstream>
#include <sstream>
#include "beam2Moments.h"
beam2Moments::beam2Moments() {
initializeMoments();
beam2Moments::beam2Moments()
{
initializeMoments();
}
beam2Moments::~beam2Moments() {;}
beam2Moments::beam2Moments( beam2Moments& tm) {
rij_secondOrderMoments_ = tm.rij_secondOrderMoments_;
beam2Moments::beam2Moments(beam2Moments& tm)
{
rij_secondOrderMoments_ = tm.rij_secondOrderMoments_;
}
beam2Moments::beam2Moments( const beam2Moments& tm) {
rij_secondOrderMoments_ = tm.rij_secondOrderMoments_;
beam2Moments::beam2Moments(const beam2Moments& tm)
{
rij_secondOrderMoments_ = tm.rij_secondOrderMoments_;
}
beam2Moments::beam2Moments(double x, double xp, double y, double yp, double dl, double del)
beam2Moments::beam2Moments(double x,double xp,double y,double yp,double dl,double del)
{
initializeMoments();
( rij_secondOrderMoments_.at(0) ).at(0) = x;
......@@ -39,7 +42,7 @@ void beam2Moments::initializeMoments()
vector< vector<double> >& beam2Moments::getMatrix()
{
return rij_secondOrderMoments_;
return rij_secondOrderMoments_;
}
const vector< vector<double> >& beam2Moments::getMoments() const
......@@ -51,7 +54,7 @@ void beam2Moments::impression() const
{
unsigned j,m;
cout << "beam2Moments::impression des moments :" << endl;
for ( j = 0; j < 6; j++)
for (j = 0; j < 6; j++)
{
for (m=0; m <= j; m++)
{
......@@ -197,19 +200,20 @@ string beam2Moments::writeToTransportInput(double P0) const
return sortie.str();
}
beam2Moments& beam2Moments::operator= (const beam2Moments& tpm) {
beam2Moments& beam2Moments::operator= (const beam2Moments& tpm)
{
rij_secondOrderMoments_ = tpm.rij_secondOrderMoments_;
return *this;
}
void beam2Moments::readFromTransportOutput(double* r)
{
// i = 0 m00 = r[0]
// i = 1 m10 = r[1] m11 = r[2]
// i = 2 m20 = r[3] m21 = r[4] m22 = r[5]
// i = 3 m30 = r[6] m31 = r[7] m32 = r[8] m33 = r[9]
// i = 4 m40 = r[10] m41 = r[11] m42 = r[12] m43 = r[13] m44 = r[14]
// i = 5 m50 = r[15] m51 = r[16] m52 = r[17] m53 = r[18] m54 = r[19] m55 = r[20]
// i= 0 m00= r[0]
// i= 1 m10= r[1] m11= r[2]
// i= 2 m20= r[3] m21= r[4] m22= r[5]
// i= 3 m30= r[6] m31= r[7] m32= r[8] m33= r[9]
// i= 4 m40= r[10] m41= r[11] m42= r[12] m43= r[13] m44= r[14]
// i= 5 m50= r[15] m51= r[16] m52= r[17] m53= r[18] m54= r[19] m55= r[20]
for (unsigned i = 0; i < rij_secondOrderMoments_.size(); i++)
{
......
......@@ -52,9 +52,9 @@ bool computingBlock::checkCoherence(string& Errors,string& Warnings)
{
if(debug > 0) cout << "computingBlock::checkCoherence()\n";
const nomDeLogiciel* prog= software_->getNomDeLogiciel();
if( prog->getString() == "unknown" ) {
Warnings += " select a software to execute commands <br /> ";
const nomDeLogiciel *prog = software_->getNomDeLogiciel();
if (prog->getString() == "unknown") {
Warnings += " select a software to execute commands\n";
return false;
}
......@@ -63,7 +63,7 @@ bool computingBlock::checkCoherence(string& Errors,string& Warnings)
{
abstractElement* elm;
elm= machine_->getElementPointer( rankOfFirstElement_+k );
trivaluedBool tb= prog->doAcceptElement( elm->getGenericName() );
trivaluedBool tb = prog->doAcceptElement( elm->getGenericName() );
if(debug > 0) {
cout << "computingBlock::checkCoherence(): " << elm->getLabel() << ",tb= " << tb << endl;
......@@ -314,7 +314,8 @@ std::vector<smap> computingBlock::trackAMLInput( UAPNode *nde )
std::vector<smap> v;
if (software == "generator") v= namelistForGenerator( nde );
if (software == "astra") v= namelistForAstra( nde );
if (software == "astra") v= namelistForAstra( nde );
if (software == "parmela") v= namelistForParmela( nde );
return v;
}
......@@ -328,25 +329,21 @@ std::vector<smap> computingBlock::namelistForGenerator( UAPNode *nde )
amap["option"].push_back( "distribution" );
v.push_back( amap ); // v[0]
if (!amap.empty()) amap.clear();
UAPNode *input= nde->getChildByName("input");
if (!input) {
printf("ERROR in computingBlock::namelistForGenerator() => the XML node <input> is mandatory\n");
v.clear();
return v;
}
// file name for initial particle distribution
string fname= "rfgun.ini";
UAPAttribute *a1= input->getAttribute("fname");
if ( a1 ) fname= a1->getValue();
UAPNode *nd1= nde->getChildByName("distribution");
if (nd1) {
UAPAttribute *a1= nd1->getAttribute("fname");
if (a1) fname= a1->getValue();
}
amap["fname"].push_back(fname);
// if true, 6 probe particles are generated
string probe= ".T";
UAPNode *nd1= input->getChildByName("probe");
if (nd1) {
UAPAttribute *a2= nd1->getAttribute("is_on");
UAPNode *nd2= nde->getChildByName("probe");
if (nd2) {
UAPAttribute *a2= nd2->getAttribute("is_on");
if (a2) probe= a2->getValue();
if ( probe.find("T") == std::string::npos ) probe= ".F";
else probe= ".T";
......@@ -355,9 +352,9 @@ std::vector<smap> computingBlock::namelistForGenerator( UAPNode *nde )
// particle coordinates are generated quasi-randomly
string noise= ".T";
UAPNode *nd2= input->getChildByName("noise_reduc");
if (nd2) {
UAPAttribute *a3= nd2->getAttribute("is_on");
UAPNode *nd3= nde->getChildByName("noise_reduc");
if (nd3) {
UAPAttribute *a3= nd3->getAttribute("is_on");
if (a3) noise= a3->getValue();
if ( noise.find("T") == std::string::npos ) noise= ".F";
else noise= ".T";
......@@ -366,13 +363,13 @@ std::vector<smap> computingBlock::namelistForGenerator( UAPNode *nde )
// the reference particle
string keys[3]= {"0.0","0.0","0.0"}; //
UAPNode *nd3= input->getChildByName("reference_particle");
if (nd3) {