PRISM
 v0.0.0
Loading...
Searching...
No Matches
TableWriterBase.h
1//* This file is a part of PRISM: Plasma Reaction Input SysteM,
2//* A library for parcing chemical reaction networks for plasma chemistry
3//* https://github.com/NCSU-ComPS-Group/prism
4//*
5//* Licensed under MIT, please see LICENSE for details
6//* https://opensource.org/license/mit
7//*
8//* Copyright 2024, North Carolina State University
9//* ALL RIGHTS RESERVED
10//*
11#pragma once
12
13#include <sstream>
14#include <string>
15#include <vector>
16#include <map>
17#include <memory>
18namespace prism
19{
20class Reaction;
22{
23public:
30 TableWriterBase(unsigned int max_rows = 32)
32 {
33 }
34
38 void clear()
39 {
40 _rxn_count = 0;
41 _note_count = 0;
42 _table_str.str("");
43 _table_str.clear();
44 }
45
50 unsigned int maxRows() { return _max_rows_per_table; }
54 std::ostringstream & tableString() { return _table_str; }
58 virtual void beginDocument(const std::vector<std::string> & bib_files) = 0;
62 virtual void endDocument() = 0;
67 virtual void beginRateBasedSection() = 0;
72 virtual void beginXSecBasedSection() = 0;
76 virtual void beginFunctionalTable() = 0;
80 virtual void endFunctionalTable() = 0;
85 virtual void beginTabulatedTable() = 0;
90 virtual void endTabulatedTable() = 0;
95 virtual void addFunctionalReaction(const std::shared_ptr<const Reaction> & r) = 0;
100 virtual void addTabulatedReaction(const std::shared_ptr<const Reaction> & r) = 0;
106 virtual void addNotes(const std::vector<std::string> & notes) = 0;
107
108protected:
110 const unsigned int _max_rows_per_table;
112 unsigned int _rxn_count;
114 unsigned int _note_count;
116 std::ostringstream _table_str;
119 std::map<std::string, unsigned int> _note_numbers;
120 std::map<unsigned int, std::string> _inverse_note_numbers;
122};
123}
Stores all of the data needed to perform calculations with a specific reaction.
Definition Reaction.h:73
const unsigned int _max_rows_per_table
the maximum number of reactions allowed per table
Definition TableWriterBase.h:110
unsigned int _note_count
a counter for all of the notes that have been added to the table
Definition TableWriterBase.h:114
virtual void endTabulatedTable()=0
Adds the end of the table for reactions which have data that is collected from a file.
void clear()
clears the state of the writer before a new writing
Definition TableWriterBase.h:38
std::map< std::string, unsigned int > _note_numbers
helper mappings between notes and their corrisponding numbering
Definition TableWriterBase.h:119
TableWriterBase(unsigned int max_rows=32)
Helper for generating a latex table based on the reaction mechanism.
Definition TableWriterBase.h:30
virtual void beginTabulatedTable()=0
Adds the beginning of the table for reactions which have data that is collected from a file.
virtual void beginFunctionalTable()=0
Adds the beginning of the table for reactions which have functional data.
std::ostringstream & tableString()
Getter method for the stream to actually write the summary to file.
Definition TableWriterBase.h:54
std::ostringstream _table_str
the string stream that is used to created the summary
Definition TableWriterBase.h:116
virtual void endDocument()=0
Adds the end of the document.
virtual void addFunctionalReaction(const std::shared_ptr< const Reaction > &r)=0
Specification for how to format a row for a single reaction which has data that can be sampled via a ...
unsigned int maxRows()
Getter method for the maximum number of reactions allowed in a single table.
Definition TableWriterBase.h:50
virtual void beginDocument(const std::vector< std::string > &bib_files)=0
Adds the document preamble to start of the latex doc.
unsigned int _rxn_count
a counter for reactions in the network
Definition TableWriterBase.h:112
virtual void beginRateBasedSection()=0
Adds a section header before the rate based reactions are put in the table.
virtual void addNotes(const std::vector< std::string > &notes)=0
Method for adding notes to the end of a single reaction additionally this method should be used to he...
virtual void endFunctionalTable()=0
Adds the end of the table for reactions which have functional data.
virtual void addTabulatedReaction(const std::shared_ptr< const Reaction > &r)=0
Specification for how to format a row for a single reaction which has data that is collected from a f...
virtual void beginXSecBasedSection()=0
Adds a section header before the cross section based reactions are put in the table.