NetDEM v1.0
Loading...
Searching...
No Matches
01_random_generation.cpp

This is an example of how to use the netdem library.

#include "data_dumper.hpp"
#include "gen_pack.hpp"
#include "gravity.hpp"
#include "shape_sphere.hpp"
#include "simulation.hpp"
#include <filesystem>
#include <iostream>
#include <unordered_map>
using namespace netdem;
using namespace std;
void RandomGeneration(int argc, char **argv) {
int num_particles = atof(argv[2]);
int num_patches = atof(argv[3]);
filesystem::create_directories("local/polybezier_model/random_generation/n" +
to_string(num_patches));
for (int i = 0; i < num_particles; i++) {
Polybezier polybezier;
polybezier.num_patches = num_patches;
polybezier.InitByRandom();
auto tmp_stl = polybezier.GetSTLModel(1000);
tmp_stl.SaveAsSTL("local/polybezier_model/random_generation/n" +
to_string(num_patches) + "/p" + to_string(i) + ".stl");
}
}
A class representing a polybezier with variable orders and patches.
Definition shape_polybezier.hpp:21
STLModel GetSTLModel(int num_nodes=200) override
Generate an STL model for the Polybezier object.
Definition shape_polybezier.cpp:251
int num_patches
Definition shape_polybezier.hpp:24
void InitByRandom()
Initialize the Polybezier object randomly.
Definition shape_polybezier.cpp:46
void SaveAsSTL(std::string const &file) const
Save the model as an STL file.
Definition stl_model.cpp:205
Definition bond_entry.hpp:7