Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91406995
surface_generator.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Nov 10, 19:46
Size
2 KB
Mime Type
text/x-c
Expires
Tue, Nov 12, 19:46 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22211148
Attached To
rTAMAAS tamaas
surface_generator.cpp
View Options
/**
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
*
* @section LICENSE
*
* Copyright (©) 2016 EPFL (Ecole Polytechnique Fédérale de
* Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des
* Solides)
*
* Tamaas 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.
*
* Tamaas 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 Tamaas. If not, see <http://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
#include <iostream>
#include <map>
#include <fstream>
/* -------------------------------------------------------------------------- */
#include "surface_generator.hh"
#include "surface_generator_voss.hh"
#include "surface_generator_filter.hh"
#include "surface_generator_filter_bessel.hh"
#include "surface_generator_filter_fft.hh"
#include "surface_generator_crenel.hh"
#include "surface_generator_ellipsoid.hh"
#include "surface_statistics.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_TAMAAS__
using namespace std;
/* -------------------------------------------------------------------------- */
/* Sort functions */
int sortAscend(const void * a, const void * b) {
return ( *(int*)a - *(int*)b );
}
/* -------------------------------------------------------------------------- */
int sortDescend(const void * a, const void * b) {
return ( *(int*)b - *(int*)a );
}
/* -------------------------------------------------------------------------- */
SurfaceGenerator::SurfaceGenerator():
rms(0.), random_seed(0),surface(NULL),gridsize(0) {
}
/* -------------------------------------------------------------------------- */
void SurfaceGenerator::Init() {
/* Post-process grid size */
if (gridsize % 2) {
SURFACE_FATAL("Grid size should even and is " << gridsize);
}
surface = new Surface<Real>(gridsize,1.);
return;
}
/* -------------------------------------------------------------------------- */
Real SurfaceGenerator::constrainRMS(){
int n = surface->size();
Real measured_rms = SurfaceStatistics::computeStdev(*surface);
std::cerr << " actual rms is " << rms << endl;
/* shift to center to mean value */
for (int i = 0 ; i < n ; ++i)
for (int j = 0 ; j < n ; ++j){
surface->at(i,j) *= rms/measured_rms;
}
return rms/measured_rms;
}
/* -------------------------------------------------------------------------- */
__END_TAMAAS__
Event Timeline
Log In to Comment