Page MenuHomec4science

dumper_epot.cc
No OneTemporary

File Metadata

Created
Sat, Aug 17, 07:12

dumper_epot.cc

/**
* @file dumper_epot.cc
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
*
* @date Wed Jul 09 21:59:47 2014
*
* @brief This dumper outputs to a single file potential energy informations
*
* @section LICENSE
*
* Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* LibMultiScale is free software: you can redistribute it and/or modify it
* under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* LibMultiScale is distributed in the hope that it will be useful, but
* WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with LibMultiScale. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "dumper_epot.hh"
#include "communicator.hh"
#include "compute_epot.hh"
#include "filter.hh"
#include "lib_continuum.hh"
#include "lib_dd.hh"
#include "lib_md.hh"
#include "lm_common.hh"
#include "ref_point_data.hh"
#include <fstream>
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
template <typename Cont> void DumperEPot<Cont>::dump(Cont &cont) {
constexpr UInt Dim = Cont::Dim;
ComputeEPot<Cont> compute("computeEpot:" + this->getID(), Dim);
compute.build(cont);
Communicator &comm = Communicator::getCommunicator();
CommGroup group = cont.getCommGroup();
UInt myrank = comm.groupRank(lm_my_proc_id, group);
if (myrank == 0) {
std::string filename = this->getBaseName() + "_epot.plot";
std::ofstream file(filename.c_str(), std::ios_base::app);
file << current_step << " " << compute[0] << std::endl;
}
}
/* -------------------------------------------------------------------------- */
template <typename Cont> void DumperEPot<Cont>::init() {
std::string fname = this->getBaseName() + "_epot.plot";
std::ofstream file(fname.c_str());
if (file.is_open() == false)
LM_FATAL("Cannot open file " << fname << " for dumper epot : exit");
}
/* -------------------------------------------------------------------------- */
/* LMDESC EPOT
This dumper outputs to a single file potential energy informations. \\ \ \
The file takes the column-like format: \\ \ \
TimeStep \hspace{1cm} EPot
*/
/* LMEXAMPLE DUMPER epotmd EPOT INPUT md FREQ 100 PREFIX ./ */
/* LMHERITANCE dumper */
template <typename Cont> void DumperEPot<Cont>::declareParams() {
Dumper<Cont>::declareParams();
}
/* -------------------------------------------------------------------------- */
DECLARE_DUMPER_REF(DumperEPot, LIST_ATOM_MODEL);
DECLARE_DUMPER_REF(DumperEPot, LIST_CONTINUUM_MODEL);
DECLARE_DUMPER_REF(DumperEPot, LIST_DD_MODEL);
DECLARE_DUMPER_REFPOINT(DumperEPot);
DECLARE_DUMPER_GENERIC_MESH(DumperEPot);
__END_LIBMULTISCALE__

Event Timeline