Page MenuHomec4science

surface_generator_filter_fft.cpp
No OneTemporary

File Metadata

Created
Thu, May 9, 01:47

surface_generator_filter_fft.cpp

/**
* @file
* @section LICENSE
*
* Copyright (©) 2016-2021 EPFL (École Polytechnique Fédérale de Lausanne),
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
#include "surface_generator_filter_fft.hh"
#include "isopowerlaw.hh"
#include "logger.hh"
#include "statistics.hh"
#include <memory>
/* -------------------------------------------------------------------------- */
namespace tamaas {
extern template class Grid<Real, 2>;
SurfaceGeneratorFilterFFT::SurfaceGeneratorFilterFFT() {
pl_filter = std::make_shared<Isopowerlaw<2>>();
generator.setFilter(pl_filter);
}
Real SurfaceGeneratorFilterFFT::constrainRMS() {
Logger().get(LogLevel::warning)
<< "Statistical bias in using the generated RMS as "
"normalizing factor!\n";
Real hrms_grid = Statistics<2>::computeRMSHeights(generator.grid);
generator.grid *= rms / hrms_grid;
return rms;
}
Grid<Real, 2>& SurfaceGeneratorFilterFFT::buildSurface() {
generator.setSizes({{grid_size, grid_size}});
return generator.buildSurface();
}
} // namespace tamaas

Event Timeline