Skip to content
Snippets Groups Projects
Commit cb0e9a7c authored by Karsten Rink's avatar Karsten Rink
Browse files

added test application for mesh reading, fixed some bugs, reading and creating...

added test application for mesh reading, fixed some bugs, reading and creating a mesh is working now; Mesh is (for now) a friend of Node, this should be fixed soon.
parent ab1b5fac
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,7 @@ ADD_SUBDIRECTORY( GeoLib )
ADD_SUBDIRECTORY( MathLib )
ADD_SUBDIRECTORY( MeshLib )
ADD_SUBDIRECTORY( SimpleTests/MatrixTests )
ADD_SUBDIRECTORY( SimpleTests/MeshTests )
IF(NOT MSVC)
ADD_SUBDIRECTORY( SimpleTests/SolverTests )
ENDIF(NOT MSVC)
......
......@@ -29,7 +29,7 @@ MeshIO::MeshIO()
MeshLib::Mesh* MeshIO::loadMeshFromFile(const std::string& file_name)
{
std::cout << "Read mesh ... " << std::flush;
std::cout << "Read mesh ... " << std::endl;
/*
#ifndef NDEBUG
QTime myTimer;
......@@ -122,7 +122,7 @@ MeshLib::Element* MeshIO::readElement(const std::string& line, const std::vector
MeshLib::Element* elem;
switch(index)
switch(elem_type)
{
case MshElemType::LINE:
for (int i = 0; i < 2; i++)
......
......@@ -5,6 +5,10 @@
* Author: KR
*/
/**
* This is currently just test functionality for testing ogs-6 mesh data structures!
*/
#ifndef MESHIO_H_
#define MESHIO_H_
......
......@@ -86,7 +86,7 @@ double getAngle (const double p0[3], const double p1[3], const double p2[3])
return acos (scpr (v0,v1,3) / (sqrt(scpr(v0,v0,3)) * sqrt(scpr (v1,v1,3))));
}
double calcTriangleaArea(const double p0[3], const double p1[3], const double p2[3])
double calcTriangleArea(const double* p0, const double* p1, const double* p2)
{
const double u0 (p2[0] - p0[0]);
const double u1 (p2[1] - p0[1]);
......
......@@ -98,7 +98,7 @@ double getAngle (const double p0[3], const double p1[3], const double p2[3]);
* Calculates the area of a triangle.
* The formula is A=.5*|u x v|, i.e. half of the area of the parallelogram specified by u=p0->p1 and v=p0->p2.
*/
double calcTriangleArea(const double p0[3], const double p1[3], const double p2[3]);
double calcTriangleArea(const double* p0, const double* p1, const double* p2);
/**
* Calculates the volume of a tetrahedron.
......
......@@ -22,8 +22,8 @@ class Node;
class Element
{
/* friend functions: */
friend void Mesh::setElementInformationForNodes();
friend void Mesh::addElement(Element*);
friend class Mesh;//void Mesh::setElementInformationForNodes();
//friend void Mesh::addElement(Element*);
public:
......
......@@ -24,11 +24,6 @@ FemMesh::FemMesh(const FemMesh &mesh)
{
}
FemMesh::FemMesh(const std::string &file_name)
: Mesh(file_name)
{
}
FemMesh::~FemMesh()
{
......
......@@ -27,9 +27,6 @@ public:
/// Copy constructor
FemMesh(const FemMesh &mesh);
/// Constructor for reading a mesh from a file
FemMesh(const std::string &file_name);
/// Destructor
virtual ~FemMesh();
......
......@@ -30,12 +30,6 @@ Mesh::Mesh(const Mesh &mesh)
{
}
Mesh::Mesh(const std::string &file_name)
{
// read mesh
this->makeNodesUnique();
}
Mesh::~Mesh()
{
const size_t nElements (_elements.size());
......
......@@ -31,9 +31,6 @@ public:
/// Copy constructor
Mesh(const Mesh &mesh);
/// Constructor for reading a mesh from a file
Mesh(const std::string &file_name);
/// Destructor
virtual ~Mesh();
......
......@@ -25,8 +25,8 @@ class Element;
class Node : public GEOLIB::PointWithID
{
/* friend functions: */
friend void Mesh::setElementInformationForNodes();
friend void Mesh::addElement(Element*);
friend class Mesh;//void Mesh::setElementInformationForNodes();
//friend void Mesh::addElement(Element*);
public:
......
INCLUDE_DIRECTORIES(
.
${CMAKE_SOURCE_DIR}/Base/
${CMAKE_SOURCE_DIR}/Base/logog/include
${CMAKE_SOURCE_DIR}/FileIO/
${CMAKE_SOURCE_DIR}/MathLib/
${CMAKE_SOURCE_DIR}/MeshLib/
)
# Create the executable
ADD_EXECUTABLE( MeshRead
MeshRead.cpp
${SOURCES}
${HEADERS}
)
TARGET_LINK_LIBRARIES ( MeshRead
MeshLib
FileIO
MathLib
Base
GeoLib
)
/*
* MeshRead.cpp
*
* Created on: 2012/05/09
* Author: KR
*/
#include "Mesh.h"
#include "MeshIO.h"
int main(int argc, char *argv[])
{
std::string file_name("c:/Project/Data/Ammer/Ammer-Homogen100m-Final.msh");
FileIO::MeshIO mesh_io;
MeshLib::Mesh* mesh = mesh_io.loadMeshFromFile(file_name);
delete mesh;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment