Dear deal.II Community,
I am working on a project where I am trying to generate a parallel mesh
using TriangulationDescription with
parallel::fullydistributed::Triangulation. My goal is to create a
triangulation from a structured grid based on a matrix of material IDs.
I have implemented the following code to generate the mesh:
template <int dim>
void LaplaceProblem<dim>::generate_mesh_from_matrix(int Nx, int Ny, int Nz)
{
std::vector<Point<dim>> vertices;
std::vector<TriangulationDescription::CellData<dim>> cells;
std::vector<unsigned int> subdomain_ids;
unsigned int vertex_counter = 0;
std::map<std::tuple<unsigned int, unsigned int, unsigned int>, unsigned
int> vertex_map;
// Generate vertices
for (unsigned int i = 0; i <= Nx; ++i)
for (unsigned int j = 0; j <= Ny; ++j)
for (unsigned int k = 0; k <= Nz; ++k)
{
Point<dim> p(i, j, k);
vertices.push_back(p);
vertex_map[std::make_tuple(i, j, k)] = vertex_counter++;
}
// Generate cells
for (unsigned int i = 0; i < Nx; ++i)
for (unsigned int j = 0; j < Ny; ++j)
for (unsigned int k = 0; k < Nz; ++k)
{
int material_id = mat_matrix[j + k * Ny][i];
if (material_id == _mat_tau_1)
{
TriangulationDescription::CellData<dim> cell;
cell.vertices = {vertex_map[std::make_tuple(i, j, k)],
vertex_map[std::make_tuple(i + 1, j,
k)],
vertex_map[std::make_tuple(i, j + 1,
k)],
vertex_map[std::make_tuple(i + 1, j +
1, k)],
vertex_map[std::make_tuple(i, j, k +
1)],
vertex_map[std::make_tuple(i + 1, j, k
+ 1)],
vertex_map[std::make_tuple(i, j + 1, k
+ 1)],
vertex_map[std::make_tuple(i + 1, j +
1, k + 1)]};
cell.material_id = material_id;
cells.push_back(cell);
subdomain_ids.push_back(Utilities::MPI::this_mpi_process(_mpi_communicator));
}
}
TriangulationDescription::Description<dim, dim>
triangulation_description;
triangulation_description.vertices = vertices;
triangulation_description.cells = cells;
triangulation_description.subdomain_ids = subdomain_ids;
triangulation_pft.create_triangulation(triangulation_description);
pcout << "Number of active cells: " <<
triangulation_pft.n_active_cells() << std::endl;
pcout << "Number of vertices: " << triangulation_pft.n_vertices() <<
std::endl;
}
When I compile the code, I get the following errors:
/home/saxenar/local/programs/tortuosity_github/source/tortuosity_parallel_FDM_discriptor_MPI.cc:957:26:
Fehler: »struct dealii::TriangulationDescription::CellData<3>« hat kein
Element namens »vertices«
/home/saxenar/local/programs/tortuosity_github/source/tortuosity_parallel_FDM_discriptor_MPI.cc:967:26:
Fehler: »struct dealii::TriangulationDescription::CellData<3>« hat kein
Element namens »material_id«
/home/saxenar/local/programs/tortuosity_github/source/tortuosity_parallel_FDM_discriptor_MPI.cc:981:31:
Fehler: »struct dealii::TriangulationDescription::Description<3, 3>« hat
kein Element namens »vertices«
/home/saxenar/local/programs/tortuosity_github/source/tortuosity_parallel_FDM_discriptor_MPI.cc:982:31:
Fehler: »struct dealii::TriangulationDescription::Description<3, 3>« hat
kein Element namens »cells«
/home/saxenar/local/programs/tortuosity_github/source/tortuosity_parallel_FDM_discriptor_MPI.cc:983:31:
Fehler: »struct dealii::TriangulationDescription::Description<3, 3>« hat
kein Element namens »subdomain_ids«
It seems I am misunderstanding how to use
TriangulationDescription::CellData and
TriangulationDescription::Description.
Could you please guide me on the correct way to set the vertices, cells,
and subdomain IDs manually without relying on the utility functions? I want
to fully understand how to use the classes and set the data correctly for
parallel::fullydistributed::Triangulation.
Thank you for your time and support.
Best regards,
Rishabh
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/dealii/bab76844-2672-46b6-a409-2196a640ee91n%40googlegroups.com.