GithubHelp home page GithubHelp logo

eigemx / unvpp Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 17.66 MB

A C++17 library for reading Ideas-UNV mesh format

License: MIT License

CMake 5.63% C++ 94.37%
c-plus-plus cpp finite-volume finite-volume-method mesh mesh-processing

unvpp's Introduction

unvpp

cmake-linux cmake-windows

A C++17 library for reading Ideas-UNV mesh format.

unvpp is designed as a parser for input UNV meshes for finite volume analysis. unvpp reads the following tags in .unv mesh files:

  • System of units tag 164
  • Nodes tag 2411 (vertices)
  • Elements tag 2412 (lines, quads, triangles, hexagons, tetrahedrons and wedges)
  • Groups tag 2452, 2467 and 757 (for boundary patches and cell zones)

Other tags are ignored.

Get Started

Using as a CMake dependency

Having CMake 3.11 or later, you can use FetchContent to add unvpp as a dependency to your project:

include(FetchContent)

FetchContent_Declare(
    unvpp
    GIT_REPOSITORY https://github.com/eigemx/unvpp.git
    GIT_TAG main
)

FetchContent_MakeAvailable(unvpp)

add_executable(main src/main.cpp)
target_link_libraries(main PRIVATE unvpp)

Build unv-report tool:

Clone the repository:

git clone https://github.com/eigemx/unvpp.git
cd unvpp && mkdir build && cd build && cmake .. && make

This will compile unvpp library and unv-report tool in build\bin directory. unv-report tool is a simple tool for printing mesh information.

Tutorial

#include <unvpp/unvpp.h>
#include <iostream>

auto main() -> int {
    unvpp::Mesh mesh = unvpp::read("./my_mesh.unv");

    // print string representation of the mesh system of units
    // if the mesh does not have a system of units, 
    // print the default "repr" representation string "Unknown".
    // Check definition of UnitsSystem in unvpp/unvpp.h file
    std::cout << "Units system: " 
              << mesh.unit_system().value_or(unvpp::UnitsSystem()).repr
              << std::endl;

    // print count of mesh vertices
    std::cout << "Vertices count = " 
              << mesh.vertices().size() 
              << std::endl;

    // print count of mesh elements (cells)
    std::cout << "Elements count = " 
              << mesh.elements().value_or(std::vector<unvpp::Element>()).size()
              << std::endl;

    // print group names and element count (like boundary patches or cell zones)
    for (auto& group : mesh.groups().value_or(std::vector<unvpp::Group>())) {
        std::cout << "Group name: " 
                  << group.name() 
                  << " - elements count = " 
                  << group.elements_ids().size()
                  << std::endl;
    }

    return 0;
}

unvpp is designed to have a minimal interface, you can understand more about the various types included in unvpp::Mesh class by simply inspecting <unvpp/unvpp.h> file!

Issues

unvpp is under active development, please feel free to open an issue for any bugs or wrong behaviour

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.