Skip to content

Commit

Permalink
[1.3.14] 2024-06-22
Browse files Browse the repository at this point in the history
***NEW PLUG-IN***
- Plant Architecture plug-in merged from development branch to master repo. This plug-in is still in beta testing and is not yet fully documented and is likely to still have a number of bugs. Please report bugs as you find them.

*Context*
- Cone object girth was not being properly scaled.

*Solar Position*
- Added sub-model to calculate solar fluxes and diffuse fraction for cloudy conditions based on radiometer measurements (see SolarPosition::enableCloudCalibration()).
- Changed many variable names to make units more explicit.

*Radiation*
- Added "ActiveGrow_LED_RedBloom" light to light spectral library.
  • Loading branch information
bnbailey-psl committed Jun 22, 2024
1 parent 2f92e5a commit 7a2fe9d
Show file tree
Hide file tree
Showing 862 changed files with 90,769 additions and 49,687 deletions.
52 changes: 52 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Contributing to Helios

Thanks for contributing to [Helios](https://github.com/PlantSimulationLab/Helios)!

The following set of guidelines should be taken as suggestion, rather than rules. These are currently a work-in-progress, and will evolve along with the project.

If you have comments or suggestions, please feel free to [open an issue](https://github.com/PlantSimulationLab/Helios/issues/new) or [submit a pull-request](https://github.com/PlantSimulationLab/Helios/compare) to this file.

## Editing Documentation

Documentation source files for the Helios core can be found in `doc/UserGuide.dox`, and for each plugin in the corresponding plug-in directory sub-folder `doc/*.dox`. These files are written in [Doxygen](https://www.doxygen.nl/index.html) format. Additionally, documentation for data structures, functions, methods, etc. is written directly in the corresponding header file, and also uses Doxygen syntax.

If you edit the documentation and want to view the changes, you can build the documentation HTML files. To do this, you need to have Doxygen installed on your system. Then, navigate to the Helios root directory and run:

```bash
doxygen doc/Doxyfile
```

To view the built documentation, open the file `doc/html/index.html` in a web browser.

## Submitting Changes

To submit a change, please [push local changes to a branch](https://docs.github.com/en/get-started/using-git/pushing-commits-to-a-remote-repository), and [create a pull-request on github](https://github.com/PlantSimulationLab/Helios/compare). Please make edits to the latest version of the master to the extent possible in order to allow for straight-forward merging of the changes into the master. Pull requests should include a clear list of changes summarizing the overall contents of the change.

Each individual commits should be prefaced with a one-line summary of the intended change. Large and complex commits may also include a longer description, separated by at least one line:

```
$ git commit -m "A brief summary of the commit.
>
> A paragraph describing the change in greater detail."
```

## Style Guide

Code formatting for C++ sources is handled automatically by [clang-format](https://clang.llvm.org/docs/ClangFormat.html), which should be executed before pushing to `master`. To do this, you can run the following from a Unix terminal:

```
git diff --name-only master -- '***.cpp' '***.cu' '***.h' | xargs clang-format -i
```

Alternatively, configure your CLion client to apply formatting on save or before commit.

In cases where the auto-formatter is inappropriate, you can disable formatting for a region of code by wrapping it with `// clang-format (off|on)` comments:

```
// clang-format off
... your_code_here ...
// clang-format on
```

Finally, note that formatting is disabled for external libraries contained in `./core/lib/...`.

55 changes: 13 additions & 42 deletions core/src/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3527,34 +3527,11 @@ helios::vec3 Cone::getNodeCoordinate(int node_index ) const{
}

std::vector<float> Cone::getNodeRadii() const{
std::vector<float> radii_T;
radii_T.resize(2);
for( int i=0; i<2; i++ ){

vec3 n0(0,0,0), nx(radii.at(i),0,0);
vec3 n0_T, nx_T;

vecmult(transform,n0,n0_T);
vecmult(transform,nx,nx_T);

radii_T.at(i) = (nx_T-n0_T).magnitude();

}
return radii_T;
return radii;
}

float Cone::getNodeRadius( int node_index ) const{
if(node_index < 0 || node_index > 1 ){
helios_runtime_error("ERROR (Cone::getNodeRadius): node number must be 0 or 1.");
}

vec3 n0(0,0,0), nx(radii.at(node_index), 0, 0);
vec3 n0_T, nx_T;

vecmult(transform,n0,n0_T);
vecmult(transform,nx,nx_T);

return (nx_T-n0_T).magnitude();
return radii.at(node_index);;
}

uint Cone::getSubdivisionCount() const{
Expand Down Expand Up @@ -3655,44 +3632,38 @@ void Cone::scaleGirth( float S ){

// calculate the transformed axis unit vector of the cone
vec3 axis_unit_vector = helios::make_vec3(nodes_T.at(1).x - nodes_T.at(0).x, nodes_T.at(1).y - nodes_T.at(0).y, nodes_T.at(1).z - nodes_T.at(0).z );
float length = powf(powf(axis_unit_vector.x,2) + powf(axis_unit_vector.y,2) + powf(axis_unit_vector.z,2),0.5);
axis_unit_vector = axis_unit_vector / length;
axis_unit_vector.normalize();

//translate node 0 back to origin
context->getConeObjectPointer(OID)->translate(-1.0*nodes_T.at(0));

//rotate the cone to align with z axis
helios::vec3 z_axis = make_vec3(0,0,1);
//get the axis about which to rotate
vec3 ra = cross( z_axis, axis_unit_vector);
//get the angle to rotate
float dot = axis_unit_vector.x*z_axis.x + axis_unit_vector.y*z_axis.y + axis_unit_vector.z*z_axis.z;
float dot = axis_unit_vector*z_axis;
float angle = acos_safe(dot);
//only rotate if the cone is not alread aligned with the z axis (i.e., angle is not zero. If zero, the axis of rotation is 0,0,0 and we end up with problems)
//only rotate if the cone is not already aligned with the z axis (i.e., angle is not zero. If zero, the axis of rotation is 0,0,0 and we end up with problems)
if(angle != float(0.0)){
context->getConeObjectPointer(OID)->rotate( -1*angle, ra );
}

// scale the cone in the z (length) dimension
float T[16], T_prim[16];
makeScaleMatrix( make_vec3(S,S,1), T);
matmult(T,transform,transform);
for( uint UUID : UUIDs){
if( context->doesPrimitiveExist( UUID ) ){
context->getPrimitiveTransformationMatrix( UUID,T_prim);
matmult(T,T_prim,T_prim);
context->setPrimitiveTransformationMatrix( UUID,T_prim);
}
}
// scale the cone in the x and y dimensions
context->scaleObject( OID, make_vec3(S,S,1) );


//rotate back
if(angle != 0.0){
context->getConeObjectPointer(OID)->rotate( angle, ra );
}

// //translate back
// translate back
context->getConeObjectPointer(OID)->translate(nodes_T.at(0));

radii.at(0) *= S;
radii.at(1) *= S;


}

uint Context::addSphereObject(uint Ndivs, const vec3 &center, float radius ){
Expand Down
15 changes: 15 additions & 0 deletions doc/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -1693,3 +1693,18 @@ The radiation model has been re-designed, with the following primary additions:
- Added RadiationModel::deleteRadiationSource().
- Deleted some overloaded versions of RadiationModel::addSunSphereSource() that take a sourceID as input to change the source ID. Instead we can use RadiationModel::deleteRadiationSource() and re-add a new source.
- Fixed an error in RadiationModel::getSourceFlux() for sun sphere sources that caused the flux to be incorrect.

[1.3.14] 2024-06-22

***NEW PLUG-IN***
- Plant Architecture plug-in merged from development branch to master repo. This plug-in is still in beta testing and is not yet fully documented and is likely to still have a number of bugs. Please report bugs as you find them.

*Context*
- Cone object girth was not being properly scaled.

*Solar Position*
- Added sub-model to calculate solar fluxes and diffuse fraction for cloudy conditions based on radiometer measurements (see SolarPosition::enableCloudCalibration()).
- Changed many variable names to make units more explicit.

*Radiation*
- Added "ActiveGrow_LED_RedBloom" light to light spectral library.
2 changes: 1 addition & 1 deletion doc/DoxygenLayout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<tab type="usergroup" visible="yes" title="User's Guide" intro="">
<tab type="user" visible="yes" url="@ref Overview" title="Overview"/>
<tab type="user" visible="yes" url="@ref DependentSoftware" title="Install and Set-up"/>
<tab type="user" visible="yes" url="@ref API" title="Using the Helios API"/>
<tab type="user" visible="yes" url="@ref API" title="User/API Guide"/>
<tab type="user" visible="yes" url="@ref IO" title="File I/O"/>
<tab type="user" visible="yes" url="@ref Tutorials" title="Tutorials"/>
</tab>
Expand Down
8 changes: 4 additions & 4 deletions doc/UserGuide.dox
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! \mainpage Helios Documentation v1.3.13
/*! \mainpage Helios Documentation v1.3.14

<p> <br> </p>

Expand Down Expand Up @@ -287,7 +287,7 @@ $ git pull

*/

/*! \page API Using the Helios API
/*! \page API User/API Guide

\tableofcontents

Expand Down Expand Up @@ -1292,12 +1292,12 @@ $ git pull
std::vector<float> A;
A.push_back(2.3);
A.push_back(9.2);
context.setPrimitiveData(UUID,"somedataA",HELIOS_TYPE_FLOAT,A.size(),\&A[0]);
context.setPrimitiveData(UUID,"somedataA",HELIOS_TYPE_FLOAT,A.size(),&A[0]);

float B[2];
B[0] = 2.3;
B[1] = 9.2;
context.setPrimitiveData(UUID,"somedataB",HELIOS_TYPE_FLOAT,2,\&B[0]);
context.setPrimitiveData(UUID,"somedataB",HELIOS_TYPE_FLOAT,2,&B[0]);

}

Expand Down
2 changes: 1 addition & 1 deletion doc/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<tr id="projectrow">
<td id="projectlogo"><img alt="Logo" src="Helios_logo_small.png"/></td>
<td id="projectalign">
<div id="projectname"><span id="projectnumber">&#160;v1.3.13</span>
<div id="projectname"><span id="projectnumber">&#160;v1.3.14</span>
</div>
</td>
</tr>
Expand Down
Binary file added doc/html/CloudyFluxPartitioning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7a2fe9d

Please sign in to comment.