-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an element data criterion for mesh adaptors.
- Loading branch information
1 parent
29c30d8
commit 9153978
Showing
3 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/*This file is part of the FEBio source code and is licensed under the MIT license | ||
listed below. | ||
See Copyright-FEBio.txt for details. | ||
Copyright (c) 2021 University of Utah, The Trustees of Columbia University in | ||
the City of New York, and others. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE.*/ | ||
#include "FEElementDataCriterion.h" | ||
#include <FECore/FECoreKernel.h> | ||
|
||
BEGIN_FECORE_CLASS(FEElementDataCriterion, FEMeshAdaptorCriterion) | ||
ADD_PARAMETER(m_data, "element_data"); | ||
END_FECORE_CLASS(); | ||
|
||
FEElementDataCriterion::FEElementDataCriterion(FEModel* fem) : FEMeshAdaptorCriterion(fem) | ||
{ | ||
m_pd = nullptr; | ||
} | ||
|
||
bool FEElementDataCriterion::Init() | ||
{ | ||
m_pd = fecore_new<FELogElemData>(m_data.c_str(), GetFEModel()); | ||
if (m_pd == nullptr) return false; | ||
return FEMeshAdaptorCriterion::Init(); | ||
} | ||
|
||
bool FEElementDataCriterion::GetElementValue(FEElement& el, double& val) | ||
{ | ||
if (m_pd) | ||
{ | ||
val = m_pd->value(el); | ||
return true; | ||
} | ||
else return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/*This file is part of the FEBio source code and is licensed under the MIT license | ||
listed below. | ||
See Copyright-FEBio.txt for details. | ||
Copyright (c) 2021 University of Utah, The Trustees of Columbia University in | ||
the City of New York, and others. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE.*/ | ||
#pragma once | ||
#include <FECore/FEMeshAdaptorCriterion.h> | ||
#include <FECore/ElementDataRecord.h> | ||
|
||
class FEElementDataCriterion : public FEMeshAdaptorCriterion | ||
{ | ||
public: | ||
FEElementDataCriterion(FEModel* fem); | ||
|
||
bool Init() override; | ||
|
||
bool GetElementValue(FEElement& el, double& val) override; | ||
|
||
private: | ||
std::string m_data; | ||
FELogElemData* m_pd; | ||
|
||
DECLARE_FECORE_CLASS(); | ||
}; |