Skip to content
Snippets Groups Projects
Commit 738e04af authored by Lars Bilke's avatar Lars Bilke
Browse files

InSitu tests are always build now.

parent 6db85898
No related branches found
No related tags found
No related merge requests found
#ADD_LIBRARY(InSituLib
# VtkMeshNodalCoordinatesTemplate.txx
#)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}/../MeshLib
${CMAKE_CURRENT_SOURCE_DIR}/../MeshLib/Elements
)
#ADD_DEPENDENCIES(InSituLib STATIC VtkRescan)
ADD_LIBRARY(InSituLib
VtkMappedMesh.h
VtkMappedMesh.cpp
)
ADD_DEPENDENCIES(InSituLib STATIC VtkRescan)
/**
* \file
* \author Lars Bilke
* \date 2014-02-27
* \brief Implementation of the VtkMappedMesh class.
*
* \copyright
* Copyright (c) 2013, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#include "VtkMappedMesh.h"
#include "Element.h"
#include <vtkCellType.h>
#include <vtkCellTypes.h>
#include <vtkGenericCell.h>
#include <vtkIdTypeArray.h>
#include <vtkObjectFactory.h>
#include <vtkPoints.h>
namespace InSituLib {
vtkStandardNewMacro(VtkMappedMesh)
void VtkMappedMesh::PrintSelf(ostream &os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
// TODO
os << indent << "NumberOfCells: " << this->NumberOfCells << endl;
}
bool VtkMappedMesh::SetElements(std::vector< MeshLib::Element * > const & elements)
{
_elements = &elements;
return true;
}
vtkIdType VtkMappedMesh::GetNumberOfCells()
{
return this->NumberOfCells;
}
int VtkMappedMesh::GetCellType(vtkIdType cellId)
{
return (int)(*_elements)[cellId]->getCellType();
}
void VtkMappedMesh::GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)
{
ptIds->SetNumberOfIds((int)(*_elements)[cellId]->getNNodes());
std::transform(this->GetElementStart(cellId),
this->GetElementEnd(cellId),
ptIds->GetPointer(0), NodeToPoint);
}
void VtkMappedMesh::GetPointCells(vtkIdType ptId, *cellIds)
{
const int targetElement = PointToNode(ptId);
int *element = this->GetStart();
int *elementEnd = this->GetEnd();
cellIds->Reset();
element = std::find(element, elementEnd, targetElement);
while (element != elementEnd)
{
cellIds->InsertNextId(static_cast<vtkIdType>((element - this->Elements)
/ this->CellSize));
element = std::find(element, elementEnd, targetElement);
}
}
int VtkMappedMesh::GetMaxCellSize()
{
return this->CellSize;
}
void VtkMappedMesh::GetIdsOfCellsOfType(int type,
{
array->Reset();
if (type == this->CellType)
{
array->SetNumberOfComponents(1);
array->Allocate(this->NumberOfCells);
for (vtkIdType i = 0; i < this->NumberOfCells; ++i)
{
array->InsertNextValue(i);
}
}
}
int VtkMappedMesh::IsHomogeneous()
{
return 1;
}
void VtkMappedMesh::Allocate(vtkIdType, int)
{
vtkErrorMacro("Read only container.")
return;
}
vtkIdType VtkMappedMesh::InsertNextCell(int, vtkIdList*)
{
vtkErrorMacro("Read only container.")
return -1;
}
vtkIdType VtkMappedMesh::InsertNextCell(int, vtkIdType, vtkIdType*)
{
vtkErrorMacro("Read only container.")
return -1;
}
vtkIdType VtkMappedMesh::InsertNextCell(
int, vtkIdType, vtkIdType*, vtkIdType, vtkIdType*)
{
vtkErrorMacro("Read only container.")
return -1;
}
void VtkMappedMesh::ReplaceCell(vtkIdType, int, vtkIdType*)
{
vtkErrorMacro("Read only container.")
return;
}
VtkMappedMesh::VtkMappedMesh()
: Elements(NULL),
CellType(VTK_EMPTY_CELL),
CellSize(0),
NumberOfCells(0)
{
}
VtkMappedMesh::~VtkMappedMesh()
{
delete [] this->Elements;
}
} // end namespace
/**
* \file
* \author Lars Bilke
* \date 2014-02-27
* \brief Definition of the VtkMappedMesh class.
*
* \copyright
* Copyright (c) 2013, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#ifndef VTKMAPPEDMESH_H_
#define VTKMAPPEDMESH_H_
#include <vtkObject.h>
#include <vtkMappedUnstructuredGrid.h>
class vtkGenericCell;
namespace MeshLib {
class Element;
}
namespace InSituLib
{
class VtkMappedMesh : public vtkObject
{
public:
static VtkMappedMesh *New();
virtual void PrintSelf(ostream &os, vtkIndent indent);
vtkTypeMacro(VtkMappedMesh, vtkObject)
bool SetElements(std::vector< MeshLib::Element * > const & elements);
// API for vtkMappedUnstructuredGrid's implementation
vtkIdType GetNumberOfCells();
int GetCellType(vtkIdType cellId);
void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds);
int GetMaxCellSize();
void GetIdsOfCellsOfType(int type, vtkIdTypeArray *array);
int IsHomogeneous();
// This container is read only -- these methods do nothing but print a warning.
void Allocate(vtkIdType numCells, int extSize = 1000);
vtkIdType InsertNextCell(int type, vtkIdList *ptIds);
vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds);
vtkIdType InsertNextCell(int type, vtkIdType npts, vtkIdType *ptIds,
vtkIdType nfaces, vtkIdType *faces);
void ReplaceCell(vtkIdType cellId, int npts, vtkIdType *pts);
protected:
VtkMappedMesh();
~VtkMappedMesh();
private:
VtkMappedMesh(const VtkMappedMesh &); // Not implemented.
void operator=(const VtkMappedMesh &); // Not implemented.
const std::vector<MeshLib::Element*>* _elements;
vtkIdType NumberOfCells;
};
} // end namespace
#endif // VTKMAPPEDMESH_H_
......@@ -2,7 +2,7 @@
* \file
* \author Lars Bilke
* \date 2014-02-26
* \brief Definition of the ElementStatus class.
* \brief Definition of the VtkMeshNodalCoordinates class.
*
* \copyright
* Copyright (c) 2013, OpenGeoSys Community (http://www.opengeosys.org)
......
......@@ -19,17 +19,18 @@
/**
* \brief Types of mesh elements supported by OpenGeoSys.
* Values are from VTKCellType enum
*/
enum class MeshElemType
{
INVALID,
LINE,
QUAD,
HEXAHEDRON,
TRIANGLE,
TETRAHEDRON,
PRISM,
PYRAMID
INVALID = 0,
LINE = 3,
QUAD = 9,
HEXAHEDRON = 12,
TRIANGLE = 5,
TETRAHEDRON = 10,
PRISM = 16,
PYRAMID = 14
};
/**
......
......@@ -8,6 +8,7 @@ APPEND_SOURCE_FILES(TEST_SOURCES)
APPEND_SOURCE_FILES(TEST_SOURCES AssemblerLib)
APPEND_SOURCE_FILES(TEST_SOURCES BaseLib)
APPEND_SOURCE_FILES(TEST_SOURCES GeoLib)
APPEND_SOURCE_FILES(TEST_SOURCES InSituLib)
APPEND_SOURCE_FILES(TEST_SOURCES MathLib)
APPEND_SOURCE_FILES(TEST_SOURCES MeshLib)
APPEND_SOURCE_FILES(TEST_SOURCES NumLib)
......@@ -16,16 +17,12 @@ IF (QT4_FOUND)
APPEND_SOURCE_FILES(TEST_SOURCES FileIO)
ENDIF()
IF (OGS_BUILD_GUI)
APPEND_SOURCE_FILES(TEST_SOURCES InSituLib)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/InSituLib)
ENDIF()
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/AssemblerLib
${CMAKE_SOURCE_DIR}/BaseLib
${CMAKE_SOURCE_DIR}/FileIO
${CMAKE_SOURCE_DIR}/GeoLib
${CMAKE_SOURCE_DIR}/InSituLib
${CMAKE_SOURCE_DIR}/MathLib
${CMAKE_SOURCE_DIR}/MeshLib
${CMAKE_SOURCE_DIR}/MeshGeoToolsLib
......@@ -64,6 +61,7 @@ ENDIF ()
IF(OGS_BUILD_GUI)
TARGET_LINK_LIBRARIES(testrunner
InSituLib
QtDataView
VtkVis
${VTK_LIBRARIES}
......
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