Skip to content

Commit

Permalink
Removes Map (unused)
Browse files Browse the repository at this point in the history
  • Loading branch information
lmdiazangulo committed Jan 15, 2025
1 parent ac112a3 commit 21f3269
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 129 deletions.
42 changes: 0 additions & 42 deletions src/types/Map.h

This file was deleted.

20 changes: 2 additions & 18 deletions src/types/Mesher.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once

#include "Mesh.h"
#include "Map.h"

namespace meshlib {

Expand All @@ -11,23 +10,8 @@ class Mesher {
virtual ~Mesher() = default;

virtual Mesh mesh() const = 0;
virtual Map getMap() const = 0;
virtual bool isStructured() const = 0;

static Mesh getNotMeshedElems(const Mesh& input, const Map& map)
{
Mesh res;
res.coordinates = input.coordinates;
res.groups.resize(input.groups.size());
for (GroupId g = 0; g < input.groups.size(); g++) {
for (ElementId e = 0; e < input.groups[g].elements.size(); e++) {
if (map.groups[g].elements[e].empty()) {
res.groups[g].elements.push_back(input.groups[g].elements[e]);
}
}
}
return res;
}
virtual bool isStructured() const = 0;

};

}
66 changes: 1 addition & 65 deletions src/utils/Cleaner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,6 @@
namespace meshlib {
namespace utils {

void Cleaner::clean(Mesh& output, Map& map)
{
cleanElems_ (output, map);
cleanCoords_(output, map);
}

void Cleaner::cleanCoords(Mesh& output)
{
Map map;
cleanCoords_(output, map);
}

void Cleaner::removeRepeatedElementsIgnoringOrientation(Mesh& m)
{
std::vector<std::set<ElementId>> toRemove(m.groups.size());
Expand Down Expand Up @@ -179,51 +167,8 @@ void Cleaner::fuseCoords(Mesh& mesh)
});
}


void Cleaner::cleanElems_(Mesh& output, Map& map)
{
std::size_t numUnstrElems = 0;
std::size_t numStrElems = 0;
for (GroupId g = 0; g < map.groups.size(); g++) {
numUnstrElems += map.groups[g].elements.size();
numStrElems += output.groups[g].elements.size();
}

for (GroupId g = 0; g < map.groups.size(); g++) {
std::vector<bool> elemsUsed(output.groups[g].elements.size(), false);
for (ElementId e = 0; e < map.groups[g].elements.size(); e++) {
for (ElementId
mE = 0; mE < map.groups[g].elements[e].size(); mE++) {
elemsUsed[map.groups[g].elements[e][mE]] = true;
}
}
std::map<ElementId, ElementId> elemsMap;
std::vector<Element> aux = output.groups[g].elements;
output.groups[g].elements.clear();
for (ElementId e = 0; e < aux.size(); e++) {
if (elemsUsed[e]) {
elemsMap[e] = output.groups[g].elements.size();
output.groups[g].elements.push_back(aux[e]);
}

}
for (ElementId e = 0; e < map.groups[g].elements.size(); e++) {
Map::Element aux = map.groups[g].elements[e];
map.groups[g].elements[e].clear();
for (ElementId mE = 0; mE < aux.size(); mE++) {
if (elemsMap.count(aux[mE]) != 0) {
map.groups[g].elements[e].push_back(elemsMap[aux[mE]]);
}
}

}
}

}

void Cleaner::cleanCoords_(Mesh& output, Map& map)
void Cleaner::cleanCoords(Mesh& output)
{
const std::size_t& numUnstrCoords = map.coordinates.size();
const std::size_t& numStrCoords = output.coordinates.size();

IdSet coordsUsed;
Expand All @@ -233,9 +178,6 @@ void Cleaner::cleanCoords_(Mesh& output, Map& map)
coordsUsed.insert(e.vertices.begin(), e.vertices.end());
}
}
for (auto const strCoords: map.coordinates) {
coordsUsed.insert(strCoords.begin(), strCoords.end());
}

std::map<CoordinateId, CoordinateId> remap;
std::vector<Coordinate> aux = output.coordinates;
Expand All @@ -256,12 +198,6 @@ void Cleaner::cleanCoords_(Mesh& output, Map& map)

}
}

for (CoordinateId c = 0; c < map.coordinates.size(); c++) {
for (std::size_t i = 0; i < map.coordinates[c].size(); i++) {
map.coordinates[c][i] = remap[map.coordinates[c][i]];
}
}

}

Expand Down
5 changes: 1 addition & 4 deletions src/utils/Cleaner.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "../types/Map.h"
#include "../types/Mesh.h"
#include "Types.h"

#include <functional>

Expand All @@ -10,7 +10,6 @@ namespace utils {

class Cleaner {
public:
static void clean(Mesh&, Map&);
static void cleanCoords(Mesh&);
static void fuseCoords(Mesh&);
static void removeElementsWithCondition(Mesh&, std::function<bool(const Element&)>);
Expand All @@ -19,8 +18,6 @@ class Cleaner {
static void removeRepeatedElementsIgnoringOrientation(Mesh&);
static void removeElements(Mesh&, const std::vector<IdSet>&);
private:
static void cleanElems_(Mesh&, Map&);
static void cleanCoords_(Mesh&, Map&);
static void fuseCoords_(Mesh&);

static Elements findDegenerateElements_(const Group&, const Coordinates&);
Expand Down

0 comments on commit 21f3269

Please sign in to comment.