@@ -595,6 +595,63 @@ struct PGGHelper
595595 }
596596 }
597597
598+ static void
599+ create_grid (ParsedGridGenerator<1 , 3 > *p,
600+ Triangulation<1 ,3 > &tria)
601+ {
602+ if (p->grid_name == " rectangle" )
603+ {
604+ Tensor<1 ,1 > initializer1;
605+ Tensor<1 ,1 > initializer2;
606+ for (unsigned int i=0 ; i<1 ; ++i)
607+ {
608+ initializer1[i]=p->point_option_one (i);
609+ initializer2[i]=p->point_option_two (i);
610+ }
611+ Point<1 > p1 (initializer1);
612+ Point<1 > p2 (initializer2);
613+
614+ GridGenerator::subdivided_hyper_rectangle (tria,
615+ p->un_int_vec_option_one ,
616+ p2,
617+ p1,
618+ p->colorize );
619+ }
620+ else if (p->grid_name == " file" )
621+ {
622+ GridIn<1 , 3 > gi;
623+ gi.attach_triangulation (tria);
624+
625+ std::ifstream in (p->input_grid_file_name .c_str ());
626+ AssertThrow (in, ExcIO ());
627+
628+ std::string ext = extension (p->input_grid_file_name );
629+ if (ext == " vtk" )
630+ gi.read_vtk (in);
631+ else if (ext == " msh" )
632+ gi.read_msh (in);
633+ else if (ext == " ucd" || ext == " inp" )
634+ gi.read_ucd (in);
635+ else if (ext == " unv" )
636+ gi.read_unv (in);
637+ else if (ext == " ar" )
638+ {
639+ boost::archive::text_iarchive ia (in);
640+ tria.load (ia, 0 );
641+ }
642+ else if (ext == " bin" )
643+ {
644+ boost::archive::binary_iarchive ia (in);
645+ tria.load (ia, 0 );
646+ }
647+ else
648+ Assert (false , ExcNotImplemented ());
649+ }
650+ else
651+ AssertThrow (false , ExcMessage (" Not implemented: " + p->grid_name ));
652+
653+ }
654+
598655 /* *
599656 * This function is used to generate grids when spacedim = dim = 3.
600657 */
@@ -886,25 +943,34 @@ void ParsedGridGenerator<dim, spacedim>::create(Triangulation<dim,spacedim> &tri
886943 Assert (grid_name != " " , ExcNotInitialized ());
887944 PGGHelper::create_grid ( this , tria);
888945
889- parse_manifold_descriptors (optional_manifold_descriptors);
946+ if (!(dim==1 && spacedim==3 ))
947+ {
948+ parse_manifold_descriptors (optional_manifold_descriptors);
890949
891- if (copy_boundary_to_manifold_ids || create_default_manifolds)
892- GridTools::copy_boundary_to_manifold_id (tria);
950+ if (copy_boundary_to_manifold_ids || create_default_manifolds)
951+ GridTools::copy_boundary_to_manifold_id (tria);
893952
894- if (copy_material_to_manifold_ids)
895- GridTools::copy_material_to_manifold_id (tria);
953+ if (copy_material_to_manifold_ids)
954+ GridTools::copy_material_to_manifold_id (tria);
896955
897- if (create_default_manifolds)
898- parse_manifold_descriptors (default_manifold_descriptors);
956+ if (create_default_manifolds)
957+ parse_manifold_descriptors (default_manifold_descriptors);
899958
900- // Now attach the manifold descriptors
901- for (auto m: manifold_descriptors)
902- {
903- tria.set_manifold (m.first , *m.second );
959+ // Now attach the manifold descriptors
960+ for (auto m: manifold_descriptors)
961+ {
962+ tria.set_manifold (m.first , *m.second );
963+ }
904964 }
905965
906966}
907967
968+ template <>
969+ void
970+ ParsedGridGenerator<1 , 3 >::parse_manifold_descriptors(const std::string &)
971+ {
972+ Assert (false ,ExcNotImplemented ());
973+ }
908974
909975template <int dim, int spacedim>
910976void
@@ -923,7 +989,6 @@ ParsedGridGenerator<dim, spacedim>::parse_manifold_descriptors(const std::string
923989}
924990
925991
926-
927992template <int dim, int spacedim>
928993void ParsedGridGenerator<dim, spacedim>::write(const Triangulation<dim,spacedim> &tria,
929994 const std::string &filename) const
@@ -1019,7 +1084,7 @@ D2K_NAMESPACE_CLOSE
10191084
10201085template class deal2lkit ::ParsedGridGenerator<1 ,1 >;
10211086template class deal2lkit ::ParsedGridGenerator<1 ,2 >;
1022- // template class deal2lkit::ParsedGridGenerator<1,3>;
1087+ template class deal2lkit ::ParsedGridGenerator<1 ,3 >;
10231088template class deal2lkit ::ParsedGridGenerator<2 ,2 >;
10241089template class deal2lkit ::ParsedGridGenerator<2 ,3 >;
10251090template class deal2lkit ::ParsedGridGenerator<3 ,3 >;
0 commit comments