## Domain Editor

### Mouse modes

In Grid, the user has different mouse modes to accomplish his tasks. There are 4 types of tasks you can accomplish with the mouse

1. Selecting domain items
2. Controlling the view port
3. Creating domain items
4. Assigning properties to domain items.

To edit a domain you usually use the mouse. The left button is the action button which let's you perform the actions for the current mouse mode. The right button opens the context menu (which is of couse different for the different mouse modes). In some mouse modes you can use the middle mouse button as a shortcut for function which require the left mouse button along with the Control or Shift key. You can also access the context menu by pressing Space.

#### Selection Mode

To select single domain items, one can simply click on them. To select multiple domain items, click and hold the left mouse button until the box surrounds all items you want to select. Holding Shift allows you to select additional items, holding Control to unselect items.

The selected items can be moved around by pressing and holding the middle button while moving the mouse around. Hold Control to enforce horizontal or vertical movement.

The context menu offers some possibilities to change the selection:

- Select all selects every domain item in the domain.
- Select none unselects all domain items.
- Select Parallelblocks opens an input dialog which allows the user to enter the number of the parallelblock whose elements shall be selected.
- Show selection opens up a dialog which lists the selected domain items and allows you to remove unwanted items from the selection. For example, you can remove all items of a specific type from the selection or keep only those of a certain type.
- Browse selection opens a domain browser which contains only the selected items.
- Fit viewbox for selection sets the viewbox such that it contains only the selected items.
- Copy, Paste and Delete do just that.

Another use of the context menu is the construction of the meshes. To create edges, select two or more nodes and choose one of the Add Edges entries from the menu. The Add Edges function comes in multiple variants:

- Add Edges connects the selected nodes with edges in the same order as they were selected.
- Add all possible Edges connects every two selected nodes with edges.
- Add Edges cyclic connects the selected nodes with edges in the same order as they were selected and connects the last node to the first node.
- Add Edges fanwise connects nodes 1 with nodes i and i+1 for every node i>1 in the selection but the last. See the picture below to get the idea.
- Add Edges stripwise connects nodes i with i+1 and i+2 for every selected node but the last two. See the second picture for a visualization of the process.

Tris and quads can be created quite easily. Select the edges which should be joined and the program will automatically find out which ones can be combined to the chosen form. For quads there is a shortcut: select 4 nodes and choose Add Quads (2D). Grid will then automatically arrange the four selected nodes such that they make up a quad.

Tetras and hexas are created from Tri3Ds and Quad3Ds. Just select all faces which should be combined to a tetra or hexa and Grid automatically combines them.

The Operations submenu gives access to some more or less complex operations one can use to manipulate the domain:

- Extrude creates a copy of the selected nodes and edges and connects every node with it's copy through an edge. This is useful to create 3D domain from an existing 2D domain.
- Transform opens up a dialog, that can be used to perform some geometrical operations on the selected nodes. On the Move... tab you can enter by which distance every selected node should be moved.
  On the Rotate... tab, one can give a center for the rotation and choose around which axis the nodes should be rotated. The rotation angle is given in degrees.
  On the Scale... tab, one can enter the scale factors for the x-, y-, and z-direction and coordinates which are used as reference point for the scaling operation. If set, the cursor position is taken as reference point for the transform operations. The cursor position can be set by pressing 0. The cursor is then set to the current mouse position.

- Replace Point replaces the first selected node with the second selected node.
- Refine Quad elements can be used to divide the selected quads into smaller quads by replacing them with so called transition elements.

- Edge-Loop -> SegmentList Convert selected edges to a segment list. The edges have to be in the correct order and have to be connected to each other with the last connecting to the first again.
- CBN to Inner Convert a cartesian boundary node to an inner node.
- Inner to CBN Convert an inner node to a cartesian boundary node.
- Boundary Node to Inner Node Convert a parameterized boundary node to an inner node.
- Inner Node to Boundary Node Convert an inner node to a parameterized boundary node.
- Snapshot BoundaryNode positions Save the current 3D coordinates of the selected boundary nodes.
- Restore BoundaryNode positions Restore the previously saved positions of the selected boundary nodes (as good as possible).
- Reparameterize selected circles In the dialog which pops up, one can select the boundary node which should be at position 0 on the circle. The circle is then reparameterized according to that selection.
- Change direction of selected boundaries Change the direction of the selected boundaries. The boundary nodes stay at the position given by the parameter.
- Change direction of the selected boundaries and reparameterize Change the direction of the selected boundaries. The boundary nodes stay at their actual position in space.

#### View Mode

The view mode can be used to manipulate the camera with the mouse. The left mouse button can be used to move the camera around. To rotate the camera you can hold Control while dragging the mouse.

As always the context menu offers some useful functions in the context of the mouse mode:

- Reset to center resets to camera into it's default position which is at (0,0,-100), with target point (0,0,0).
- Refresh simply redraws the domain.
- Zoom 1x resets the zoom level to 1.0.
- Zoom in doubles the current zoom level.
- Zoom out halves the current zoom level.
- Show all set the camera zoom such that all domain items are visible.
- Show active Grid If a grid of guidelines has been defined (in the preferences dialog) and the grid is not infinite, the camera is set such that all of that grid is visible.
- Set zoom... shows a dialog in which the zoom level can be entered.
- Look at... opens a sub menu in which one of the default camera positions can be activated. The top button sets the camera to point straight down at the x-y-plane, front is for the x-z-plane and side is the y-z-plane.
- Show statusbar is used to toggle the statusbar of the editor on and off.

#### Zoom Mode

In the zoom mode you can draw a box around the area you want to zoom into. The middle mouse button can be used to zoom out.

#### Move Mode

Hold the left mouse button and move the mouse around to move all selected items to a new position. Use Control to enforce horizontal or vertical movement.

#### Point Mode

In the point mode, different type of nodes can be placed in the domain by clicking with the left mouse button. The target point of the camera is taken as reference point for the translation from the screen position to the position in 3D. To place a point at the x-y-plane at z=200 one has to set the camera position to something like (0,0,-100) with target point (0,0,200) with the camera button in the toolbar.

The context menu can be used to set which type of points are placed:

- Create Points is used to place points. Those are usually part of a boundary and are used to describe a position or outline. As they are placed automatically in the other mouse modes, one should not place them himself without reason.
- Create Parameterized Boundary Nodes As boundary nodes do not have a position in space but a position on a boundary, the effect of clicking into the domain in this mouse mode is different. The node is automatically put on the nearest point of the nearest boundary. The user can restrict the value of the parameter for the position to multiples of 0.1 or 0.01 by holding the Shift or Control key while clicking.
- Create Inner Nodes creates inner nodes at the position which corresponds to the screen position when the user left clicks into the domain.
- Create Cartesian Boundary Nodes does the same for cartesian boundary nodes.
  Cartesian boundary nodes are not assigned to a special boundary after creation. You have to assign them manually to a boundary with the domain browser or the quick edit feature.

#### Segment List Mode

Segment lists are quite complex. In their simplest form, they are polygons. Depending on the direction of the segment list (counterclockwise or clockwise), they include or exclude the area they enclose. Instead of lines one can also use circle segments or NURBS. The process of creating a segment list is always the same. At first, the control points for the "polygon" are placed by clicking into the editor with the left mouse button. Then the control point type can be changed by right clicking on it and choosing the new type from the context menu.

- "Normal" point (every two normal points are connected with line segments)
- Circle center (counterclockwise) - the point will be the center of a counterclockwise circle; it is automatically placed in such a way that it is exactly in the middle between the two neighbour points. By ensuring this, Grid enforces a closed segment list.
- Circle center (clockwise)
- NURBS control point - to describe a NURBS, a set of control points is needed. These points describe a very rough approximation of the spline curve.
- First NURBS control point. If the segment list has multiple NURBS one after another, the first point of the second NURBS must be marked as being the first, such that Grid can see where one NURBS ends and the second begins.

The different point types can also be placed directly, by holding the Shift key for counterclockwise circles or the Control key for NURBS control points. To add the segment list to the domain, you can click the Done! entry in the context menu or double click one of the control points.

Points can also be moved by dragging them around with the left mouse button pressed. Clicking on the small circles on the lines connecting the control points creates a new control point at that position. The context menu offers some additional manipulation tools for the segment list:

- Add point before point under cursor Insert a new point halfway between the point you clicked on and the previous point.
- Add point after point under cursor Insert a new point halfway between the point you clicked on and the next point.
- Remove point under cursor Remove the point below the mouse cursor.
- Set NURBS default degree Set the degree for all newly created NURBS control points.
  This option does not change the degree of the already placed. Also, be aware that only the degree of the first point of a NURBS is read to determine the degree of the whole NURBS.
- Change degree of Point under cursor Change the degree of the point below the cursor. Keep in mind the advice above.
- Change multiplicity of Point under cursor Change the multiplicity of the point below the cursor.
- Edit This submenu allows to edit already existing segment list. Just select the entry of a segment list and manipulate it as usual.
- Restart Start over.
- Done! Compile the segment list and add it to the domain.

The functions which target a specific point use the mouse position at the time of the activation of the popup menu as reference. So you have to move the mouse over the point you want to manipulate and then open the context menu with the middle mouse button or Space.

#### Clockwise/Counterclockwise Circle Mode

The circle mode is used to create circle boundaries. Normally, circle boundaries run from 0 to 1 with 0 at the twelve o'clock position. A circle can be placed with two clicks: the first sets the center point, the second the radius.

To change the parameter interval of a circle use the quick edit feature or the domain browser.

#### Sphere Mode

Spheres can be created in the sphere mouse mode. Just click once to set the center of the sphere, then move the mouse until the radius fits and press the mouse again.

#### Make Rectangular Mode

This mouse mode can be used to make quads rectangular with one click. Just click into the corner of the quad which shall be rectangular and the coordinates are adjusted to this.

#### Block Painting Mode

The block painting mode can be used to quickly assign matrix- or parallelblock numbers to quad elements. The context menu can be used to determine what number and what type of number to set. Then this number can be easily assigned to the quads elements by clicking on them. If you use the feast rendering style (from the preferences dialog), you can immediately see the changes.

#### Anisotropy Setting Mode

In this mode, you can click into quads, to set its refinement direction. Just click near the edge or corner and the parameters will be correctly set. Click into the center of the quad to set the refinement mode to "None".

#### Proportional Node Editing

In the proportional node editing mode you can move points around as you are doing in the move mode. The difference is that along with the point in the center the points in the surrounding circle are also moved, but only proportionally to their distance to the point in the center. The radius of the circle can be changed with the mouse wheel.

#### Side note: Quick edit

Quick edit is a feature of the domain editor. Just hover the mouse over the item you want to edit and press the Return key. A dialog appears in which the values for the item can be entered. If multiple items are at that position, the correct can be chosen from a popup menu.

#### Preferences for the Domain Editor

In the preferences dialog, many different setting can be changed for the domain editor. The settings are categorized and distributed over different tabs. To apply your settings without closing the dialog, one can press the Apply button. Ok does the same and closes the dialog whereas Close closes the dialog without applying the changes. Sets of setting can be loaded and saved in files using the Load scheme... and Save scheme... buttons. Defaults resets to the factory defaults.

To use the settings of an editor as default for all newly opened editors, one can save these by clicking on the Save defaults entry in the Domain menu. This does not change the factory defaults.

Sometimes during a version change it may occur that new options were added to the dialog. This can result in a strange or even wrong display of your domains. If this happens, you should delete the file g3ddefaults.xml from the directory in which devisor saves its settings. On Un*x platforms this is the directory .devisor in your homedir. On Windows it is placed in the directory devisor in your "My Documents" folder.

In the items tab, you can choose which types of domain items are drawn. Additionally, some hints on the structure can be displayed:

- Rectangular quads can be highlighted.
- The first point of a quad can be marked with an arrow.
- In the FEAST rendering mode, quad elements are filled with colours, depending on their parallelblock numbers and the lines between the quads indicate if they belong to the same matrixblock. Additional lines indicate how the quads will be refined with its actual refinement parameters. Line types and colours can be changed on the colour tab.
- Instead of the boundaries, the faces of the boundary can be drawn. To find out about a face being on the boundary, the numbers of edge neighbours for that face is caculated and compared to the threshold given in the dialog. The boundary faces can also be drawn filled.

In the numbers tab, one can choose of which domain items the numbers are displayed. For quad elements, four numbers are shown: element number, matrixblock and parallelblock number.

The colours tab provides access to the colour and line style settings for the domain items. Usually, all domain items of one type have the same colour. This is different only for the boundaries. Boundaries get their colour according to their number. The first boundary gets the first boundary colour, the second get the second colour and so on. When all colours are used they begin with the first again. The lower two boxes are used for the FEAST rendering mode. Here you can determine the linestyles and colors used to display the parallelblock and matrixblock informations.

The cutplane tab allows you to define cutplanes. Only items on that cutplane will be displayed in the editor. For the definition of the cutplane two parameters have to be defined. The first is the axis which the cutplane is orthogonal to and the second is the offset for the plane on that axis. Additionally, one can give a parameter epsilon which allows you to include items which are not further than epsilon units away from the cutplane.

On the snapping tab, mouse snapping can be set up. There are basically three options. Turn mouse snapping off completely, snap uniformly or snap on grid. Choosing an uniform snap of 0.1 lets you only place nodes at x-, y- and z-coordinates which are multiples of 0.1. Grid snapping does basically the same, but you can choose different snap factors for the three axis and define the origin and extent of the grid. Only the selected grid is used for grid snapping and is displayed in the editor. When no grid is selected, no snapping is applied.

On the misc tab, the paths to external programs like Trigen and Metis can be set. One can also turn off the statusbar of the domain editor and choose how many subdivisions are used to approximate NURBS and circles.