Note that on Linux you need to provide correctly the path (starting with dot-slash-bin), in order to execute a file. Similarly on Windows you should execute (eg. from a command line) the file gsView.exe
The default build type (if not specified with the CMAKE_BUILD_TYPE setting) is Release. Contrarily to the default setting of CMake, in G+Smo the macro NDEBUG is defined in this setting. Therefore in RelWithDebInfo mode you still get a fairly good checking level, with the cost that the performance is reduced.
The Debug mode is often too slow. However, as a last resort for chasing bugs this mode should be tried. Several times RelWithDebInfo inlines functions, and causes the debug information to point to the wrong line in the code.
A handy class called gsCmdLine for adding command line options to your programs. Adding options to a program makes it more friendly to the users, while allowing you to execute many different scenarios without having to change the source code and re-compile the source file.
Command-line arguments are useful to avoid re-compiling your code every time a small parameter is altered, as well as to make your program easily accessible by others. In G+Smo there is an easy way to add command-line arguments, which come automatically with a small help message and error checking, see commandLineArg_example.cpp.
The last argument of each "add" command is, as expected, a boolean (for the addSwitch), or an integer (for the addInt). The gsCmdLine::getValues command parses all the user's input and updates the variables with new values. Therefore, after this command, the value of all the variables can be different. If an argument is not provided by the user, then the value of the variable does not change.
and we obtain a list of the arguments together with the short explanation that we provided in the definition of the argument. Note that all arguments are checked automatically during parsing, eg. duplicate arguments and other subtle errors are detected.
Combined with reading the input data from files, this feature allows you eg. to write code which works for any input file which contains data that G+Smo can read, merely by adding a command line argument which accepts a string describing a filename.
The native format for data input, output and data exchange is XML. In G+Smo we define a number of tags that are used to read and write respective objects (classes). Typically, the data in an XML tree which represent, for instance, a B-spline, follow the logic of the classes in the code. As a first example the file square.xml is:
The space between the numbers and line breaks do not matter. The plain text files can become big in size, when the data is a lot. For this reason, a compressed XML format is also supported, which can also be read/written directly.
All the tags in the XML tree of a G+Smo XML file must be contained inside the tag. Arbitrary data can be contained inside an XML file, as long as they are valid XML files. If you write (a small) XML file yourself, you can validate it for instance this page to make sure that there are no errors. In any case, invalid files will not be read properly by G+Smo and errors will be emitted. Each object in a G+Smo XML is also expected to have a unique ID attribute, which can be used for identifiing the specific data in the file.
In the above code note the default value of the input string: The macro GISMO_DATA_DIR always points to the filedata folder inside the source folder. Using this macro allows you to make sure that your default argument will work on any system which will compile the library. Using an absolute path such as /home/myname/gismo/filedata/square.xml will directly make your program to fail when used in a different system. Therefore the GISMO_DATA_DIR macro is highly recommended.
When creating the gsFileData object, all the XML data in the file are loading into memory as an XML tree. This XML tree can contain many different objects. In the above, the gsFileData::has helper searches the tree for the existence of a gsGeometry tag. This tag corresponds to a polymorphic geometry object (which can be a polynomial curve, surface or volume or a rational NURBS patch, or a different type of geometry/patch). In the case that a gsGeometry object is found, a pointer is allocated and returned to the user. As the name of the get function suggests, the returned object is the first object which was encountered in the XML tree.
reads two matrices from an XML tree, that correspond to parameters and values for a fitting problem. The uv matrix is fetched from the file as the matrix inside the file with id=0, and then the xyz matrix is fetched again by its id=1. this way there is no ambiguity which object is being read from the tree (as long as we use unique ids).
Another command which appears in the above example is the safe function. This macro takes a pointer to a matrix (which is the returned type of getId, and produces a smart pointer. The smart pointer is then transferred to uv/xyz matrices. This is an emulation of the move semantics of C++11, which we do not use yet, for the sake of compatibility.
Apart from the native XML format of the library, a number of third party formats can be imported or exported. One such useful format is Rhino's 3DM file format (note: the gsOpennurbs submodule must be enabled). Also, the Siemens' NX (Parasolid) file format is supported, if the Parasolid library is available in the system (note: GISMO_WITH_PSOLID compilation parameter). Other formats include the GeoPDE (Matlab/octave) text format, the GoTools format and OBJ, OFF and STL mesh files. The IGES file format is under development.
The sparse matrix class is gsSparseMatrix and is derived from Eigen::SparseMatrix class. Several sparse linear solvers are available, demonstrated in sparseSolvers_example.cpp. The main information about the matrix manipulations can be found in the Eigen documentation pages. We link to the most important chapters:
There is also a list with the correspondance to Matlab functions. However, note that some operations of Matlab are not mirrored (yet) with functionality in Eigen. For example, a reshape function does not exist. The Topic Aliasing is also important to learn how to avoid bugs and write more efficient code.
All the information and functionality in the above pages apply to the gsMatrix, gsVector and gsSparseMatrix, gsSparseVector classes. For certain functionalities, which we need to extend or adapt in G+Smo, for example for the sparse liner solver classes, there are more objects defined which correspond to Eigen objects. In general, we try to avoid the direct use of the Eigen namespace inside the library, whenever possible.
Matrix operations of Eigen should be preferred over using for loops or manual functions. One reason for this is the clarity of the code, the reduction of lines of code and last but not least the fact that the provided operations are vectorized therefore they are more efficient than manual coding.
From these 3 versions, the last one is preferred, since we know well from linear algebra that left multiplication by a diagonal matrix corresponds to multiplying the rows by the diagonal elements. Note that v.asDiagonal() does not make a copy of the vector v, but only returns an expression of the v as a diagonal matrix. Also note the noalias() function to avoid Aliasing, eg. an un-needed temporary copy of R3.
One of the most basic objects in G+Smo are the ones representing functions. There are several implementations of functions, or sets of functions. They all derive by a common class, gsFunctionSet. The main descendants of gsFunctionSet are two:
This class represents a (abstract) functions of several variables, possibly vector-valued. The function is defined over an (arbitrary) square domain, referred to as its support. One characteristic of the function is that in principle it takes non-zero values throughout its support.
The main attributes of functions (and bases) are the dimension of the parameter domain and the target domain, as well as their support. The main functionality is the ability to evaluate the function and its derivatives at given points inside the support.
One instance of function is the gsFunctionExpr. This class can be defined by a string containing the mathematical formula of a function. It makes it very easy ad efficient to define and work with complicated mathematical function with minimal effort.
This class represent an (abstract) function basis, that is, a set of basis functions. The functions are usually local, that is, they take non-zero value only at a small portion of the support of the basis. See basis_example.cpp
One more instance of a function (derived from gsFunction) is the gsGeometry. This class is essentially a function defined by a coefficient vector and a gsBasis. For example a NURBS patch will fall in this category.
Matlab projects give you an insight into the tools used in Matlab. Matlab contains numerous tools and toolboxes, which makes it an idle platform for research. We are working with Matlab tutors near me for the past ten years and have served students from various countries.
Matlab contains numerous tools and toolboxes, which makes it an idle platform for research. Being a world no.1 organization, we provide all kind of IEEE matlab projects support and guidance to our scholar to excel in their research career.
c80f0f1006