Ipopt Documentation  
 
Loading...
Searching...
No Matches
Ipopt::Journalist Class Reference

Class responsible for all message output. More...

#include <IpJournalist.hpp>

+ Inheritance diagram for Ipopt::Journalist:

Public Member Functions

Constructor / Desructor.
 Journalist ()
 Constructor.
 
virtual ~Journalist ()
 Destructor...
 
Author Methods.

These methods are used by authoring code, or code that wants to report some information.

virtual void Printf (EJournalLevel level, EJournalCategory category, const char *format,...) const
 Method to print a formatted string.
 
virtual void PrintStringOverLines (EJournalLevel level, EJournalCategory category, Index indent_spaces, Index max_length, const std::string &line) const
 Method to print a long string including indentation.
 
virtual void PrintfIndented (EJournalLevel level, EJournalCategory category, Index indent_level, const char *format,...) const
 Method to print a formatted string with indentation.
 
virtual void VPrintf (EJournalLevel level, EJournalCategory category, const char *pformat, va_list ap) const
 Method to print a formatted string using the va_list argument.
 
virtual void VPrintfIndented (EJournalLevel level, EJournalCategory category, Index indent_level, const char *pformat, va_list ap) const
 Method to print a formatted string with indentation, using the va_list argument.
 
virtual bool ProduceOutput (EJournalLevel level, EJournalCategory category) const
 Method that returns true if there is a Journal that would write output for the given JournalLevel and JournalCategory.
 
virtual void FlushBuffer () const
 Method that flushes the current buffer for all Journalists.
 
Reader Methods.

These methods are used by the reader.

The reader will setup the journalist with each output file and the acceptance criteria for that file.

Use these methods to setup the journals (files or other output). These are the internal objects that keep track of the print levels for each category. Then use the internal Journal objects to set specific print levels for each category (or keep defaults).

virtual bool AddJournal (const SmartPtr< Journal > jrnl)
 Add a new journal.
 
virtual SmartPtr< JournalAddFileJournal (const std::string &location_name, const std::string &fname, EJournalLevel default_level=J_WARNING, bool file_append=false)
 Add a new FileJournal.
 
virtual SmartPtr< JournalGetJournal (const std::string &location_name)
 Get an existing journal.
 
virtual void DeleteAllJournals ()
 Delete all journals currently known by the journalist.
 
- Public Member Functions inherited from Ipopt::ReferencedObject
 ReferencedObject ()
 
virtual ~ReferencedObject ()
 
Index ReferenceCount () const
 
void AddRef (const Referencer *referencer) const
 
void ReleaseRef (const Referencer *referencer) const
 

Private Member Functions

Default Compiler Generated Methods

(Hidden to avoid implicit creation/calling).

These methods are not implemented and we do not want the compiler to implement them for us, so we declare them private and do not define them. This ensures that they will not be implicitly created/called.

 Journalist (const Journalist &)
 Copy Constructor.
 
void operator= (const Journalist &)
 Default Assignment Operator.
 

Private Attributes

std::vector< SmartPtr< Journal > > journals_
 

Detailed Description

Class responsible for all message output.

This class is responsible for all messaging and output. The "printing" code or "author" should send ALL messages to the Journalist, indicating an appropriate category and print level. The journalist then decides, based on reader specified acceptance criteria, which message is actually printed in which journals. This allows the printing code to send everything, while the "reader" can decide what they really want to see.

Authors: Authors use the Journals: You can add as many Journals as you like to the Journalist with the AddJournal or the AddFileJournal methods. Each one represents a different printing location (or file). Then, you can call the "print" methods of the Journalist to output information to each of the journals.

Acceptance Criteria: Each print message should be flagged appropriately with an EJournalCategory and EJournalLevel.

The AddFileJournal method returns a pointer to the newly created Journal object (if successful) so you can set Acceptance criteria for that particular location.

Definition at line 116 of file IpJournalist.hpp.

Constructor & Destructor Documentation

◆ Journalist() [1/2]

Ipopt::Journalist::Journalist ( )

Constructor.

◆ ~Journalist()

virtual Ipopt::Journalist::~Journalist ( )
virtual

Destructor...

◆ Journalist() [2/2]

Ipopt::Journalist::Journalist ( const Journalist )
private

Copy Constructor.

Member Function Documentation

◆ Printf()

virtual void Ipopt::Journalist::Printf ( EJournalLevel  level,
EJournalCategory  category,
const char format,
  ... 
) const
virtual

Method to print a formatted string.

◆ PrintStringOverLines()

virtual void Ipopt::Journalist::PrintStringOverLines ( EJournalLevel  level,
EJournalCategory  category,
Index  indent_spaces,
Index  max_length,
const std::string &  line 
) const
virtual

Method to print a long string including indentation.

The string is printed starting at the current position. If the position (counting started at the current position) exceeds max_length, a new line is inserted, and indent_spaces many spaces are printed before the string is continued. This is for example used during the printing of the option documentation.

◆ PrintfIndented()

virtual void Ipopt::Journalist::PrintfIndented ( EJournalLevel  level,
EJournalCategory  category,
Index  indent_level,
const char format,
  ... 
) const
virtual

Method to print a formatted string with indentation.

◆ VPrintf()

virtual void Ipopt::Journalist::VPrintf ( EJournalLevel  level,
EJournalCategory  category,
const char pformat,
va_list  ap 
) const
virtual

Method to print a formatted string using the va_list argument.

◆ VPrintfIndented()

virtual void Ipopt::Journalist::VPrintfIndented ( EJournalLevel  level,
EJournalCategory  category,
Index  indent_level,
const char pformat,
va_list  ap 
) const
virtual

Method to print a formatted string with indentation, using the va_list argument.

◆ ProduceOutput()

virtual bool Ipopt::Journalist::ProduceOutput ( EJournalLevel  level,
EJournalCategory  category 
) const
virtual

Method that returns true if there is a Journal that would write output for the given JournalLevel and JournalCategory.

This is useful if expensive computation would be required for a particular output. The author code can check with this method if the computations are indeed required.

◆ FlushBuffer()

virtual void Ipopt::Journalist::FlushBuffer ( ) const
virtual

Method that flushes the current buffer for all Journalists.

Calling this method after one optimization run helps to avoid cluttering output with that produced by other parts of the program (e.g. written in Fortran)

◆ AddJournal()

virtual bool Ipopt::Journalist::AddJournal ( const SmartPtr< Journal jrnl)
virtual

Add a new journal.

◆ AddFileJournal()

virtual SmartPtr< Journal > Ipopt::Journalist::AddFileJournal ( const std::string &  location_name,
const std::string &  fname,
EJournalLevel  default_level = J_WARNING,
bool  file_append = false 
)
virtual

Add a new FileJournal.

Returns
the Journal pointer so you can set specific acceptance criteria, or NULL if there was a problem creating a new Journal.
Parameters
location_namestring identifier, which can be used to obtain the pointer to the new Journal at a later point using the GetJournal method
fnamename of the file to which this Journal corresponds; use "stdout" for stdout and use "stderr" for stderr
default_leveldefault journal level used to initialize the printing level for all categories
file_appendwhether to append to file or truncate it (since 3.14.13)

◆ GetJournal()

virtual SmartPtr< Journal > Ipopt::Journalist::GetJournal ( const std::string &  location_name)
virtual

Get an existing journal.

You can use this method to change the acceptance criteria at runtime.

◆ DeleteAllJournals()

virtual void Ipopt::Journalist::DeleteAllJournals ( )
virtual

Delete all journals currently known by the journalist.

◆ operator=()

void Ipopt::Journalist::operator= ( const Journalist )
private

Default Assignment Operator.

Member Data Documentation

◆ journals_

std::vector<SmartPtr<Journal> > Ipopt::Journalist::journals_
private

Definition at line 274 of file IpJournalist.hpp.


The documentation for this class was generated from the following file: