Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit c0585560 authored by adelmann's avatar adelmann :reminder_ribbon:
Browse files

add instumentation

parent b37286d3
No related branches found
No related tags found
1 merge request!19Drift-0 ro Drift-2
......@@ -5,6 +5,8 @@
*.a
*.aux
*.h5
#*#
*.dat
optimizer/Tests/*.exe
build
data
......
......@@ -87,6 +87,7 @@ if(NOT IPPL_VERSION)
set(IPPL_VERSION "3.2.0")
message(STATUS "Defaulting to IPPL-${IPPL_VERSION}")
endif()
FetchContent_Declare(ippl
#URL https://github.com/IPPL-framework/ippl/archive/refs/tags/IPPL-${IPPL_VERSION}.tar.gz
GIT_REPOSITORY https://github.com/IPPL-framework/ippl.git
......@@ -95,6 +96,23 @@ FetchContent_Declare(ippl
)
set(ENABLE_COSMOLOGY OFF CACHE BOOL "Disable Cosmology in IPPL")
set(IPPL_GIT_TAG "" CACHE STRING "Optional branch or tag for IPPL")
#URL https://github.com/IPPL-framework/ippl/archive/refs/tags/IPPL-${IPPL_VERSION}.tar.gz
if(IPPL_GIT_TAG)
FetchContent_Declare(ippl
GIT_REPOSITORY https://github.com/IPPL-framework/ippl.git
GIT_TAG ${IPPL_GIT_TAG}
GIT_SHALLOW True
DOWNLOAD_EXTRACT_TIMESTAMP True
)
else()
FetchContent_Declare(ippl
GIT_REPOSITORY https://github.com/IPPL-framework/ippl.git
GIT_SHALLOW True
DOWNLOAD_EXTRACT_TIMESTAMP True
)
endif()
FetchContent_MakeAvailable(ippl)
include_directories("${IPPL_SOURCE_DIR}/src")
......
......@@ -36,7 +36,7 @@ D1: DRIFT, L = 1.0, ELEMEDGE = 0.0;
myLine: Line = (D1);
BEAM1: BEAM, PARTICLE = ELECTRON, pc = P0, NPART = n_particles,
BFREQ = rf_freq, BCURRENT = beam_bunch_charge * rf_freq * 1E6, CHARGE = -1;
BFREQ = rf_freq, BCURRENT = beam_bunch_charge * rf_freq, CHARGE = -1;
FS1: Fieldsolver, NX=32, NY=32, NZ=32, TYPE=FFT, PARFFTX = true, PARFFTY = true, PARFFTZ = false,
......
//
// Class FieldWriter
// This class writes the bunch internal fields on the grid to
// file. It supports single core execution only.
//
// Copyright (c) 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_FIELD_WRITER_H
#define OPAL_FIELD_WRITER_H
#include <string>
class FieldWriter
{
public:
/// Dump a scalar or vector field to a file.
/*
* @param[in] field is the scalar or vector field on the grid
* @param[in] name is the field name
* @param[in] unit of the field
* @param[in] step of the output
* @param[in] image of the potential (optional)
*/
template<typename FieldType>
void dumpField(FieldType& field, std::string name,
std::string unit, long long step,
FieldType* image = nullptr);
};
#include "FieldWriter.hpp"
#endif
\ No newline at end of file
//
// Class FieldWriter
// This class writes the bunch internal fields on the grid to
// file. It supports single core execution only.
//
// Copyright (c) 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#include <iomanip>
#include <fstream>
#include <boost/filesystem.hpp>
#include <boost/format.hpp>
#include "Utilities/Util.h"
#include "AbstractObjects/OpalData.h"
// #include "Algorithms/PBunchDefs.h"
template<typename FieldType>
void FieldWriter::dumpField(FieldType& field, std::string name,
std::string unit, long long step,
FieldType* image)
{
if (ippl::Comm->size() > 1) {
return;
}
/*
constexpr bool isVectorField = std::is_same<VField_t, FieldType>::value;
std::string type = (isVectorField) ? "field" : "scalar";
INFOMSG("*** START DUMPING " + Util::toUpper(name) + " FIELD ***" << endl);
*/
/* Save the files in the output directory of the simulation. The file
* name of vector fields is
*
* 'basename'-'name'_field-'******'.dat
*
* and of scalar fields
*
* 'basename'-'name'_scalar-'******'.dat
*
* with
* 'basename': OPAL input file name (*.in)
* 'name': field name (input argument of function)
* '******': step padded with zeros to 6 digits
*/
/*
std::string dirname = "";
boost::filesystem::path file(dirname);
boost::format filename("%1%-%2%-%|3$06|.dat");
std::string basename = OpalData::getInstance()->getInputBasename();
filename % basename % (name + std::string("_") + type) % step;
file /= filename.str();
INFOMSG("*** FILE NAME " + file.string() << endl);
std::ofstream fout(file.string(), std::ios::out);
fout.precision(9);
fout << "# " << name << " " << type << " data on grid" << std::endl
<< "#"
<< std::setw(4) << "i"
<< std::setw(5) << "j"
<< std::setw(5) << "k"
<< std::setw(17) << "x [m]"
<< std::setw(17) << "y [m]"
<< std::setw(17) << "z [m]";
if (isVectorField) {
fout << std::setw(10) << name << "x [" << unit << "]"
<< std::setw(10) << name << "y [" << unit << "]"
<< std::setw(10) << name << "z [" << unit << "]";
} else {
fout << std::setw(13) << name << " [" << unit << "]";
}
if (image) {
fout << std::setw(13) << name << " image [" << unit << "]";
}
fout << std::endl;
Vector_t origin = field.get_mesh().get_origin();
Vector_t spacing(field.get_mesh().get_meshSpacing(0),
field.get_mesh().get_meshSpacing(1),
field.get_mesh().get_meshSpacing(2));
NDIndex<3> localIdx = field.getLayout().getLocalNDIndex();
for (int x = localIdx[0].first(); x <= localIdx[0].last(); x++) {
for (int y = localIdx[1].first(); y <= localIdx[1].last(); y++) {
for (int z = localIdx[2].first(); z <= localIdx[2].last(); z++) {
NDIndex<3> idx(Index(x, x), Index(y, y), Index(z, z));
fout << std::setw(5) << x + 1
<< std::setw(5) << y + 1
<< std::setw(5) << z + 1
<< std::setw(17) << origin(0) + x * spacing(0)
<< std::setw(17) << origin(1) + y * spacing(1)
<< std::setw(17) << origin(2) + z * spacing(2);
if (isVectorField) {
Vector_t vfield = field.localElement(idx);
fout << std::setw(17) << vfield[0]
<< std::setw(17) << vfield[1]
<< std::setw(17) << vfield[2];
} else {
fout << std::setw(17) << field.localElement(idx);
}
if (image) {
fout << std::setw(17) << image->localElement(idx);
}
fout << std::endl;
}
}
}
fout.close();
INFOMSG("*** FINISHED DUMPING " + Util::toUpper(name) + " FIELD ***" << endl);
*/
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment