Skip to content

Commit

Permalink
Upgrading Cleaver2 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
allywarner committed Dec 16, 2019
1 parent 0fabc69 commit ca79e7e
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/

#include <gtest/gtest.h>

#include <Core/Datatypes/Legacy/Field/VField.h>
#include <Core/Datatypes/Legacy/Field/FieldInformation.h>
#include <Core/Datatypes/Matrix.h>
#include <Core/Algorithms/Field/InterfaceWithCleaverAlgorithm.h>
#include <Core/Algorithms/Field/InterfaceWithCleaver2Algorithm.h>
#include <Testing/Utils/SCIRunUnitTests.h>
#include <Core/Datatypes/DenseMatrix.h>

Expand All @@ -41,18 +41,18 @@ using namespace SCIRun::Core::Geometry;
using namespace SCIRun::Core::Algorithms::Fields;
using namespace SCIRun::TestUtils;


FieldHandle BoxSignedDistanceField(bool negative)
{
{

FieldInformation f("LatVolMesh", 1, "float");
size_type size = 3;
Point minb(-1.0, -1.0, -1.0);
Point maxb(1.0, 1.0, 1.0);
MeshHandle omesh = CreateMesh(f, size, size, size, minb, maxb);
FieldHandle ofield = CreateField(f,omesh);
std::vector<double> values(27);

values[0]=-1.73205077648162841796875;
values[1]=-1.41421353816986083984375;
values[2]=-1.73205077648162841796875;
Expand Down Expand Up @@ -80,15 +80,15 @@ using namespace SCIRun::TestUtils;
values[24]=-1.73205077648162841796875;
values[25]=-1.41421353816986083984375;
values[26]=-1.73205077648162841796875;

if (negative)
{
for (int i=0;i<27;i++)
{
values[i]=-values[i];
}
}

ofield->vfield()->resize_values();
ofield->vfield()->set_values(values);
return ofield;
Expand All @@ -97,19 +97,19 @@ using namespace SCIRun::TestUtils;
TEST(CleaverInterfaceTest, SphereSignedDistanceFieldMatrix1)
{
InterfaceWithCleaverAlgorithm algo;

std::vector<FieldHandle> inputs;
inputs.push_back(BoxSignedDistanceField(true));
inputs.push_back(BoxSignedDistanceField(false));

auto info = algo.run(inputs);

std::cout << "Number of mesh elements: " << info->vmesh()->num_elems() << std::endl;
std::cout << "Number of mesh nodes: " << info->vmesh()->num_nodes() << std::endl;
std::cout << "Number of mesh values: " << info->vfield()->num_values() << std::endl;

ASSERT_TRUE(info->vmesh()->num_elems() == 4326);
ASSERT_TRUE(info->vmesh()->num_nodes() == 908);
ASSERT_TRUE(info->vfield()->num_values() == 4326);

}

0 comments on commit ca79e7e

Please sign in to comment.