30 assert(position_mesh->is_from_same_multi_mesh_structure(*periodic_mesh));
35 auto surface_accessor = position_mesh->create_accessor<int64_t>(surface_handle);
38 surface_accessor.scalar_attribute(f) =
45 std::shared_ptr<Mesh> surface_mesh = position_mesh->get_child_meshes().back();
49 assert(position_mesh->get_child_meshes().size() == 1);
50 assert(periodic_mesh->get_child_meshes().size() == 1);
53 auto position_handle =
56 auto surface_position_handle =
59 auto propagate_to_child_position =
60 [](
const Eigen::MatrixX<double>& P) -> Eigen::VectorX<double> {
return P; };
62 auto update_child_positon =
63 std::make_shared<wmtk::operations::SingleAttributeTransferStrategy<double, double>>(
64 surface_position_handle,
66 propagate_to_child_position);
68 update_child_positon->run_on_all();
70 wmtk::logger().info(
"registered surface mesh to position mesh");
72 std::vector<attribute::MeshAttributeHandle> pass_through_attributes;
73 pass_through_attributes.push_back(surface_handle);
86 pass_through_attributes,
This class generates a multi-mesh from a mesh where the substructure is represented by a tag.
void remove_soup()
Remove the substructure soup from the multimesh.
void compute_substructure_mesh()
Create a manifold mesh from the substructure.
void write_mesh(const Mesh &m, const std::string &name, const std::map< std::string, std::vector< int64_t >> &multimesh_names={})
Write a mesh to cache.
std::shared_ptr< Mesh > read_mesh(const std::string &name) const
Load a mesh from cache.
void periodic_optimization(Mesh &periodic_mesh, Mesh &position_mesh, Mesh &surface_mesh, const double target_edge_length, const double max_amips_energy, const int64_t passes, const double envelope_size, const bool intermediate_output, std::vector< attribute::MeshAttributeHandle > &pass_through_attributes, std::string output_dir, std::string output)
void periodic_optimization(const utils::Paths &paths, const nlohmann::json &j, io::Cache &cache)
spdlog::logger & logger()
Retrieves the current logger.
std::string position_mesh
std::string periodic_mesh
double target_edge_length