25#include "bitpit_common.hpp"
27#include "lineunstructured.hpp"
41#if BITPIT_ENABLE_MPI==1
53 :
LineKernel(communicator, 1, ADAPTION_MANUAL, PARTITIONING_ENABLED)
64#if BITPIT_ENABLE_MPI==1
77 :
LineKernel(
PatchManager::AUTOMATIC_ID, dimension, communicator, 1, ADAPTION_MANUAL, PARTITIONING_ENABLED)
90#if BITPIT_ENABLE_MPI==1
104 :
LineKernel(id, dimension, communicator, 1, ADAPTION_MANUAL, PARTITIONING_ENABLED)
118#if BITPIT_ENABLE_MPI==1
130 :
LineKernel(communicator, 1, ADAPTION_MANUAL, PARTITIONING_ENABLED)
162 const int DUMP_VERSION = 1;
174#if BITPIT_ENABLE_MPI==1
177 throw std::runtime_error (
"Dump of lineunstructured is implemented only for serial calculations.");
198#if BITPIT_ENABLE_MPI==1
201 throw std::runtime_error (
"Restore of lineunstructured is implemented only for serial calculations.");
232 throw std::runtime_error (
"The function 'locatePoint' is not implemented yet");
257 std::vector<std::array<double, 3>> vertex_list;
258 std::vector<std::vector<int>> simplex_list;
259 std::vector<int> simplex_PID;
260 std::vector<long> vertex_map;
261 std::vector<long> connect;
264 std::vector<std::array<double, 3>>::const_iterator v_, ve_;
265 std::vector<std::vector<int>>::iterator c_, ce_;
266 std::vector<int>::iterator i_, ie_;
267 std::vector<long>::iterator j_, je_;
274 dgf_in.
load(nV, nS, vertex_list, simplex_list, simplex_PID);
277 ve_ = vertex_list.cend();
279 vertex_map.resize(nV);
280 for (v_ = vertex_list.cbegin(); v_ != ve_; ++v_) {
282 vertex_map[vcount] = idx;
287 ce_ = simplex_list.end();
288 for (c_ = simplex_list.begin(); c_ != ce_; ++c_) {
290 for (i_ = c_->begin(); i_ != ie_; ++i_) {
291 *i_ = vertex_map[*i_];
297 for (c_ = simplex_list.begin(), k = 0; c_ != ce_; ++c_, ++k) {
300 connect.resize(c_->size(), Vertex::NULL_ID);
302 for (j_ = connect.begin(); j_ != je_; ++j_) {
309 int cellPID = PIDOffset;
311 cellPID += simplex_PID[k];
314 cellIterator->setPID(cellPID);
337 long vcount, ccount, idx;
338 std::vector<std::array<double, 3>> vertex_list(nV);
339 std::vector<std::vector<int>> simplex_list(nS);
340 std::unordered_map<long, long> vertex_map;
355 vertex_list[vcount] = v_->getCoords();
356 vertex_map[idx] = vcount;
363 for (c_ =
cellBegin(); c_ != ce_; ++c_) {
365 nv = cellVertexIds.
size();
366 simplex_list[ccount].resize(nv);
367 for (v = 0; v < nv; ++v) {
368 simplex_list[ccount][v] = vertex_map[cellVertexIds[v]];
374 dgf_in.
save(nV, nS, vertex_list, simplex_list);
388 switch(nFacetVertices) {
391 return ElementType::VERTEX;
394 return ElementType::LINE;
397 return ElementType::UNDEFINED;
Interface to DGF I/O function.
void save(int &, int &, std::vector< std::vector< double > > &, std::vector< std::vector< int > > &)
void load(int &, int &, std::vector< std::vector< double > > &, std::vector< std::vector< int > > &)
The LineUnstructured class defines an unstructured line tasselation.
int _getDumpVersion() const override
void _dump(std::ostream &stream) const override
unsigned short exportDGF(const std::string &)
static ElementType getDGFFacetType(int nFacetVertices)
unsigned short importDGF(const std::string &, int PIDOffset=0, bool PIDSquash=false)
std::unique_ptr< PatchKernel > clone() const override
LineUnstructured(MPI_Comm communicator)
void _restore(std::istream &stream) override
long locatePoint(const std::array< double, 3 > &point) const override
VertexIterator vertexEnd()
void dumpInterfaces(std::ostream &stream) const
void dumpVertices(std::ostream &stream) const
void dumpCells(std::ostream &stream) const
VertexIterator vertexBegin()
virtual long getVertexCount() const
void restoreCells(std::istream &stream)
VertexIterator addVertex(const Vertex &source, long id=Vertex::NULL_ID)
CellIterator addCell(const Cell &source, long id=Element::NULL_ID)
void restoreVertices(std::istream &stream)
void restore(std::istream &stream, bool reregister=false)
void restoreInterfaces(std::istream &stream)
virtual long getCellCount() const
int getProcessorCount() const
The PatchManager oversee the handling of the patches.
id_t getId(const id_t &fallback=-1) const noexcept
Iterator for the class PiercedStorage.
Metafunction for generating a list of elements that can be either stored in an external vectror or,...
#define BITPIT_UNUSED(variable)