Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modified README.md #1

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
cmake_minimum_required(VERSION 2.8)
project(DV_B)


set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -p -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall")

message(STATUS "Running on CCV")

find_package(VTK REQUIRED)
if (vtkIOExport_LOADED AND vtkIOImport_LOADED)
vtk_module_config(VTK
vtkCommonCore
vtkIOLegacy
vtkIOXML
vtkIOGeometry
vtkInteractionStyle
vtkIOImport
vtkIOExport
vtksys
)
else()
vtk_module_config(VTK
vtkCommonCore
vtkIOLegacy
vtkIOXML
vtkIOGeometry
vtkInteractionStyle
vtkIOImport
vtksys
)
endif()
include(${VTK_USE_FILE})

include_directories(src)
add_subdirectory(src)

include_directories(test)
add_subdirectory(test)

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Final Project: Data Visualization-Team B
Teammates: Yuqi Chai, Zhiyu Wang, Yabo Yan

This is personal branch of Zhiyu Wang. The source code here will be merged to the master reporstory at last.
Binary file added src/.data_converter.cpp.swp
Binary file not shown.
36 changes: 36 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
cmake_minimum_required(VERSION 2.8)


set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -p -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall")

message(STATUS "Running on CCV")

find_package(VTK REQUIRED)
if (vtkIOExport_LOADED AND vtkIOImport_LOADED)
vtk_module_config(VTK
vtkCommonCore
vtkIOLegacy
vtkIOXML
vtkIOGeometry
vtkInteractionStyle
vtkIOImport
vtkIOExport
vtksys
)
else()
vtk_module_config(VTK
vtkCommonCore
vtkIOLegacy
vtkIOXML
vtkIOGeometry
vtkInteractionStyle
vtkIOImport
vtksys
)
endif()
include(${VTK_USE_FILE})

include_directories(read_data)
add_subdirectory(read_data)
4 changes: 4 additions & 0 deletions src/data_converter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include <iostream>

// This is the module that convert raw data into the standard vtk format

12 changes: 12 additions & 0 deletions src/data_generator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <iostream>
#include <math.h>
#include <dolfin>
#include <boost>

//data generator

a = kappa*dot(grad(u), grad(v))*dx;
L = f*v*d;

kappa = Expression(’x[0] + x[1]’, degree=1);
f = Expression(’-8*x[0] - 10*x[1]’, degree=1);
5 changes: 5 additions & 0 deletions src/data_read_in.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include <iostream>



//this is the module that convert read in the data to the process module
38 changes: 38 additions & 0 deletions src/display/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
cmake_minimum_required(VERSION 2.8)
project(read_data)


set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -p -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall")

message(STATUS "Running on CCV")

find_package(VTK REQUIRED)
if (vtkIOExport_LOADED AND vtkIOImport_LOADED)
vtk_module_config(VTK
vtkCommonCore
vtkIOLegacy
vtkIOXML
vtkIOGeometry
vtkInteractionStyle
vtkIOImport
vtkIOExport
vtksys
)
else()
vtk_module_config(VTK
vtkCommonCore
vtkIOLegacy
vtkIOXML
vtkIOGeometry
vtkInteractionStyle
vtkIOImport
vtksys
)
endif()
include(${VTK_USE_FILE})

add_library(display show_data.h show_data.cpp)
set_target_properties(display PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(display ${VTK_LIBRARIES})
Empty file added src/display/display.cpp
Empty file.
Empty file added src/display/display.h
Empty file.
39 changes: 39 additions & 0 deletions src/read_data/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 2.8)
project(read_data)


set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -p -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall")

message(STATUS "Running on CCV")

find_package(VTK REQUIRED)
if (vtkIOExport_LOADED AND vtkIOImport_LOADED)
vtk_module_config(VTK
vtkCommonCore
vtkIOLegacy
vtkIOXML
vtkIOGeometry
vtkInteractionStyle
vtkIOImport
vtkIOExport
vtksys
)
else()
vtk_module_config(VTK
vtkCommonCore
vtkIOLegacy
vtkIOXML
vtkIOGeometry
vtkInteractionStyle
vtkIOImport
vtksys
)
endif()
include(${VTK_USE_FILE})

##add_executable(data_load data_load.h data_load.cpp)
add_library(read_data data_load.h data_load.cpp)
set_target_properties(read_data PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(read_data ${VTK_LIBRARIES})
105 changes: 105 additions & 0 deletions src/read_data/data_load.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#include <vtkSmartPointer.h>
#include <vtkXMLReader.h>
#include <vtkXMLUnstructuredGridReader.h>
#include <vtkXMLPolyDataReader.h>
#include <vtkXMLStructuredGridReader.h>
#include <vtkXMLRectilinearGridReader.h>
#include <vtkXMLCompositeDataReader.h>
#include <vtkXMLStructuredGridReader.h>
#include <vtkXMLImageDataReader.h>
#include <vtkDataSetReader.h>
#include <vtkDataSet.h>
#include <vtkUnstructuredGrid.h>
#include <vtkRectilinearGrid.h>
#include <vtkImageData.h>
#include <vtkPolyData.h>
#include <vtkStructuredGrid.h>
#include <vtkPointData.h>
#include <vtkCellData.h>
#include <vtkFieldData.h>
#include <vtkCellTypes.h>
#include <vtksys/SystemTools.hxx>
#include <vtkWarpVector.h>
#include <map>

#include "data_load.h"
using namespace std;

template <class TReader> vtkAlgorithmOutput *ReadAnXMLFile(const char*fileName, vtkDataSet* &dataSet) //get this part of the code from vtk code examples
{
vtkSmartPointer<TReader> reader = vtkSmartPointer<TReader>::New();
reader->SetFileName(fileName);
reader->Update();
reader->GetOutput()->Register(reader);
//data_pipe = reader->GetOutputPort();
// vtkDataSet* res = vtkDataSet :: New();
//vtkDataSet::SafeDownCast(reader->GetOutput());
dataSet = vtkDataSet::SafeDownCast(reader->GetOutput());
return reader->GetOutputPort();
}

int data_load :: load_data(string filename){ //get this part of code from vtk code examples with slight modification
//if (filename.size()<2){
// std::cerr << "Usage: " << " XMLFile1 XMLFile2 ..." << std::endl;
//}

string extension = vtksys::SystemTools::GetFilenameLastExtension(filename);
cout<<extension<<endl;
vtkAlgorithmOutput* data_pipe;
vtkDataSet *dataSet;
if (extension == ".vtu")
{
data_pipe = ReadAnXMLFile<vtkXMLUnstructuredGridReader> (filename.c_str(),dataSet); //read the vtu file with vtkXMLUnstructuredGridTrader
}
else if (extension == ".vtp")
{
data_pipe = ReadAnXMLFile<vtkXMLPolyDataReader> (filename.c_str(),dataSet);
}
else if (extension == ".vts")
{
data_pipe = ReadAnXMLFile<vtkXMLStructuredGridReader> (filename.c_str(),dataSet);
}
else if (extension == ".vtr")
{
data_pipe = ReadAnXMLFile<vtkXMLRectilinearGridReader> (filename.c_str(), dataSet);
}
else if (extension == ".vti")
{
data_pipe = ReadAnXMLFile<vtkXMLImageDataReader> (filename.c_str(), dataSet);
}
else if (extension == ".vtk")
{
data_pipe = ReadAnXMLFile<vtkDataSetReader> (filename.c_str(), dataSet);
}
else
{
std::cerr << filename << " Unknown extension: " << extension << std::endl;
return EXIT_FAILURE;
}


int numberOfCells = dataSet->GetNumberOfCells();
int numberOfPoints = dataSet->GetNumberOfPoints();

// Generate a report
std::cout << "------------------------" << std::endl; //valid the data that has been read
std::cout << filename << std::endl
<< " contains a " << std::endl
<< dataSet->GetClassName()
<< " that has " << numberOfCells << " cells"
<< " and " << numberOfPoints << " points." << std::endl;

this->data_ = dataSet;
this->data_pipe_ = data_pipe;
return EXIT_SUCCESS;
}

vtkDataSet* data_load::get_data(){
return this->data_;
}
vtkAlgorithmOutput* data_load::get_data_pipe(){
return this->data_pipe_;
}
data_load::~data_load(){
// this->data_->Delete();
}
37 changes: 37 additions & 0 deletions src/read_data/data_load.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <vtkSmartPointer.h>
#include <vtkXMLReader.h>
#include <vtkXMLUnstructuredGridReader.h>
#include <vtkXMLPolyDataReader.h>
#include <vtkXMLStructuredGridReader.h>
#include <vtkXMLRectilinearGridReader.h>
#include <vtkXMLCompositeDataReader.h>
#include <vtkXMLStructuredGridReader.h>
#include <vtkXMLImageDataReader.h>
#include <vtkDataSetReader.h>
#include <vtkDataSet.h>
#include <vtkUnstructuredGrid.h>
#include <vtkRectilinearGrid.h>
#include <vtkImageData.h>
#include <vtkPolyData.h>
#include <vtkStructuredGrid.h>
#include <vtkPointData.h>
#include <vtkCellData.h>
#include <vtkFieldData.h>
#include <vtkCellTypes.h>
#include <vtksys/SystemTools.hxx>

#include <map>


using std::string;
class data_load{
private:
vtkDataSet* data_;
vtkAlgorithmOutput* data_pipe_;
public:
int load_data(string file_path);
vtkDataSet* get_data();
vtkAlgorithmOutput* get_data_pipe();
~data_load();
};

29 changes: 29 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
cmake_minimum_required(VERSION 2.8)
project(DV_B)


set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -p -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall")

message(STATUS "Running on CCV")


find_package(VTK REQUIRED)

include(${VTK_USE_FILE})

add_executable(DumpXMLFile DumpXMLFile.cxx)
target_link_libraries(DumpXMLFile ${VTK_LIBRARIES})

add_executable(test_io test_load_data.cpp)
target_link_libraries(test_io read_data ${VTK_LIBRARIES})

add_executable(watch_data watch_data.cpp)
target_link_libraries(watch_data read_data ${VTK_LIBRARIES})

add_executable(watch_blade watch_blade.cpp)
target_link_libraries(watch_blade read_data ${VTK_LIBRARIES})

add_executable(blades blades.cpp)
target_link_libraries(blades read_data ${VTK_LIBRARIES})
Loading