Skip to content

Commit

Permalink
Working on Agros's writeToHermes.
Browse files Browse the repository at this point in the history
  • Loading branch information
l-korous committed Mar 14, 2014
1 parent bb764c1 commit 74983f5
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 42 deletions.
14 changes: 7 additions & 7 deletions hermes2d/include/mesh/curved.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ namespace Hermes
/// current polynomial degree of the refmap approximation
int order;

/// this is called for every curvilinear element when it is created
/// or when it is necessary to re-calculate coefficients for another
/// order: 'e' is a pointer to the element to which this CurvMap
/// belongs to. First, old "coeffs" are removed if they are not nullptr,
/// then new_ coefficients are projected.
void update_refmap_coeffs(Element* e);

private:
PrecalcShapeset ref_map_pss;

Expand All @@ -129,13 +136,6 @@ namespace Hermes
int nc; ///< number of coefficients
double2* coeffs; ///< array of the coefficients

/// this is called for every curvilinear element when it is created
/// or when it is necessary to re-calculate coefficients for another
/// order: 'e' is a pointer to the element to which this CurvMap
/// belongs to. First, old "coeffs" are removed if they are not nullptr,
/// then new_ coefficients are projected.
void update_refmap_coeffs(Element* e);

void get_mid_edge_points(Element* e, double2* pt, int n);

/// Recursive calculation of the basis function N_i,k(int i, int k, double t, double* knot).
Expand Down
7 changes: 4 additions & 3 deletions hermes2d/include/mesh/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ namespace Hermes

static const int H2D_DEFAULT_HASH_SIZE = 0x8000; // 32K entries

Node* add_node();

/// Returns an edge node with parent id's p1 and p2 if it exists, nullptr otherwise.
Node* peek_edge_node(int p1, int p2) const;

protected:
HashTable();
Expand All @@ -58,9 +62,6 @@ namespace Hermes
/// Returns a vertex node with parent id's p1 and p2 if it exists, nullptr otherwise.
Node* peek_vertex_node(int p1, int p2) const;

/// Returns an edge node with parent id's p1 and p2 if it exists, nullptr otherwise.
Node* peek_edge_node(int p1, int p2) const;

/// Central function: obtains a vertex node pointer given the id
/// numbers of its parents. If the vertex node does not exist, it is
/// created first.
Expand Down
51 changes: 25 additions & 26 deletions hermes2d/include/mesh/mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,32 @@ namespace Hermes
/// For internal use.
void set_seq(unsigned seq);

private:/// For internal use.
int nbase, ntopvert, ninitial, nactive;

class ElementMarkersConversion : public MarkersConversion
{
public:
ElementMarkersConversion();
virtual MarkersConversionType get_type() const;
};

class BoundaryMarkersConversion : public MarkersConversion
{
public:
BoundaryMarkersConversion();
virtual MarkersConversionType get_type() const;
};

ElementMarkersConversion element_markers_conversion;
BoundaryMarkersConversion boundary_markers_conversion;
Array<Element> elements;

unsigned seq;

/// For internal use.
void initial_single_check();

private:
/// Refines all quad elements to triangles.
/// It refines a quadrilateral element into two triangles.
/// Note: this function creates a base mesh.
Expand All @@ -326,20 +349,13 @@ namespace Hermes
void convert_triangles_to_base(Element* e);
void convert_quads_to_base(Element* e);

Array<Element> elements;
int nactive;
unsigned seq;

/// Bounding box.
double bottom_left_x, bottom_left_y, top_right_x, top_right_y;
/// Bounding box calculated.
bool bounding_box_calculated;
/// Bounding box calculation.
void calc_bounding_box();

int nbase, ntopvert;
int ninitial;

void unrefine_element_internal(Element* e);

int* parents;
Expand All @@ -366,23 +382,6 @@ namespace Hermes
int elementId;
};

class ElementMarkersConversion : public MarkersConversion
{
public:
ElementMarkersConversion();
virtual MarkersConversionType get_type() const;
};

class BoundaryMarkersConversion : public MarkersConversion
{
public:
BoundaryMarkersConversion();
virtual MarkersConversionType get_type() const;
};

ElementMarkersConversion element_markers_conversion;
BoundaryMarkersConversion boundary_markers_conversion;

friend class MeshHashGrid;
friend class MeshReaderH2D;
friend class MeshReaderH2DBSON;
Expand Down Expand Up @@ -483,7 +482,7 @@ namespace Hermes

/// Internal marker for eggshell elements.
static const std::string eggShellMarker;

/// Verboseness of the static egg shell creation.
/// Default: true.
static bool egg_shell_verbose;
Expand Down
3 changes: 3 additions & 0 deletions hermes2d/src/mesh/curved.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ namespace Hermes
{
namespace Hermes2D
{
HERMES_API Quad1DStd g_quad_1d_std;
HERMES_API Quad2DStd g_quad_2d_std;

static H1ShapesetJacobi ref_map_shapeset;
static PrecalcShapeset ref_map_pss_static(&ref_map_shapeset);

Expand Down
5 changes: 5 additions & 0 deletions hermes2d/src/mesh/hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ namespace Hermes
return &(nodes[id]);
}

Node* HashTable::add_node()
{
return this->nodes.add();
}

/// Returns the total number of nodes stored.
int HashTable::get_num_nodes() const
{
Expand Down
4 changes: 2 additions & 2 deletions hermes2d/src/mesh/mesh_reader_h2d_xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ namespace Hermes
// save vertices
XMLMesh::vertices_type vertices;
for (int i = 0; i < mesh->ntopvert; i++)
vertices.v().push_back(std::auto_ptr<XMLMesh::v>(new XMLMesh::v(std::to_string(mesh->nodes[i].x), std::to_string(mesh->nodes[i].y), i)));
vertices.v().push_back(std::auto_ptr<XMLMesh::v>(new XMLMesh::v(std::to_string((long double)mesh->nodes[i].x), std::to_string((long double)mesh->nodes[i].y), i)));

// save elements
XMLMesh::elements_type elements;
Expand Down Expand Up @@ -641,7 +641,7 @@ namespace Hermes
vertices_to_vertices.insert(std::pair<unsigned int, unsigned int>(i, new_i));
points_to_vertices.insert(std::pair<std::pair<double, double>, unsigned int>(std::pair<double, double>(meshes[meshes_i]->nodes[i].x, meshes[meshes_i]->nodes[i].y), points_to_vertices.size()));

vertices.v().push_back(std::auto_ptr<XMLMesh::v>(new XMLMesh::v(std::to_string(meshes[meshes_i]->nodes[i].x), std::to_string(meshes[meshes_i]->nodes[i].y), i)));
vertices.v().push_back(std::auto_ptr<XMLMesh::v>(new XMLMesh::v(std::to_string((long double)meshes[meshes_i]->nodes[i].x), std::to_string((long double)meshes[meshes_i]->nodes[i].y), i)));
}
if (!hasAllElements)
subdomain.vertices()->i().push_back(vertices_to_vertices.find(i)->second);
Expand Down
3 changes: 0 additions & 3 deletions hermes2d/src/quadrature/quad_std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2557,9 +2557,6 @@ namespace Hermes

// ... for use in any module

HERMES_API Quad1DStd g_quad_1d_std;
HERMES_API Quad2DStd g_quad_2d_std;

Quad2DLin g_quad_lin;

Quad2DLin::Quad2DLin()
Expand Down
2 changes: 1 addition & 1 deletion hermes2d/src/views/linearizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ namespace Hermes
{
while (this->current_thread_size == 0)
{
if (this->current_thread_size == this->thread_sizes.size() - 1)
if (this->current_thread_size == this->thread_sizes[this->thread_sizes.size() - 1])
{
this->end = true;
break;
Expand Down

0 comments on commit 74983f5

Please sign in to comment.