Coder Social home page Coder Social logo

luanmingyi / liton_ordered_tec_cpp Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 2.0 140 KB

Ordered_tec is a simple pack writing ordered data (structural data) to a binary tecplot file (.plt).

License: MIT License

C++ 98.58% CMake 1.42%
tecplot plt ordered-data

liton_ordered_tec_cpp's Introduction

liton_ordered_tec for C++

Ordered_tec is a simple pack writing ordered data (structural data) to a binary tecplot file (.plt). This package does not need any dependency, and it directly write binary files according to Tecplot binary data format.

Features

Basic Features

  • Support 1, 2 and 3 dimensional data
  • Support multi-zone file
  • Support file types including grid, solution and full
  • Support solution time and strand Id for zone
  • Support auxiliary data for file and zone

Highlight Features

  1. Auto recognition the data type, supporting five types of data
  2. Support exclude data with Begin, End and Skip
  3. Free setting of echo mode
  4. Complete log system including log in xml and json

Usage

Download and Configuration

You only need to download all folders in scr for using this package.

Before using it in your project, you need to copy these folders into your project directory or somewhere else to make sure that the complier could find it.

Coding

The Tecplot file consists of zones and data are storage in zone. Zones describe different set of data in space or in time. All the numbers of data in different zones in one file are same. Auxiliary data is extra data attached to file or zone which can be seen and used in Tecplot.

There are six classes usually used included in the liton_ot namespace. They are TEC_FILE, TEC_ZONE, TEC_DATA and correspondingly TEC_FILE_LOG, TEC_ZONE_LOG, TEC_DATA_LOG used to contain log.

To use the package, first you need some including and namespace declaration.

# include "ordered_tec.h"
using namespace liton_ot;

Then you need to declare a TEC_FILE object and set its properties. The property Variables is a string vector containing the variables' name which is required.

TEC_FILE tec_file;
tec_file.Variables.push_back("x");
tec_file.Variables.push_back("y");
tec_file.Variables.push_back("z");

You can also set some other properties optionally.

tec_file.FileName = "Test";
tec_file.Title = "Test";
tec_file.add_auxiliary_data("a_data_1","test01");
tec_file.add_auxiliary_data("a_data_2",0.5);

Then attach a TEC_ZONE object to the file and set its properties.

tec_file.Zones.push_back(TEC_ZONE());
//x, y, z are the point to the data, the size of all data is 10 by 30
tec_file.Zones[0].Max[0] = 10;
tec_file.Zones[0].Max[1] = 30;
tec_file.Zones[0].Data.push_back(TEC_DATA(x)); //auto recognition point type
tec_file.Zones[0].Data.push_back(TEC_DATA(y));
tec_file.Zones[0].Data.push_back(TEC_DATA(z));

You can also set some other properties optionally.

tec_file.Zones[0].ZoneName = "zone_1";
tec_file.Zones[0].StrandId = 0;
tec_file.Zones[0].SolutionTime = 0.1;
tec_file.Zones[0].Begin[1] = 1; //begin of data offset 1 in second dimension
tec_file.Zones[0].End[0] = 2; //end of data offset 2 in first dimension
tec_file.Zones[0].Skip[0] = 2; //skip to write data by 2 in first dimension
tec_file.Zones[0].add_auxiliary_data("a_data_1","test01");
tec_file.Zones[0].add_auxiliary_data("a_data_2",0.5);

Before write data, you can set echo mode optionally.

tec_file.set_echo_mode("full","full");

And write data.

tec_file.write_plt();

Now you can get log in tec_file's property last_log. Also you can write the log in a xml file.

tec_file.last_log.write_xml();

Compile

The file functions are based on 32 bit, so it is not supported to write big file over 2G. Try to split data into small files.

Contribution

You can just comment in issues or contact me by email to talk about your idea or demand. Thank you.

License

MIT License

liton_ordered_tec_cpp's People

Contributors

luanmingyi avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

haider-ba cxb1993

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.