76 |
checkFinleyError(); |
checkFinleyError(); |
77 |
} |
} |
78 |
|
|
|
// void MeshAdapter::getTagList(int functionSpaceType, |
|
|
// int* numTags) const |
|
|
// { |
|
|
// Finley_Mesh_tagList(m_finleyMesh.get(),functionSpaceType,tagList,numTags); |
|
|
// return; |
|
|
// } |
|
|
|
|
79 |
string MeshAdapter::getDescription() const |
string MeshAdapter::getDescription() const |
80 |
{ |
{ |
81 |
return "FinleyMesh"; |
return "FinleyMesh"; |
160 |
} |
} |
161 |
|
|
162 |
// |
// |
|
// returns a pointer to the tag list of samples of functionSpaceType |
|
|
// |
|
|
void MeshAdapter::getTagList(int functionSpaceType, int** tagList, |
|
|
int* numTags) const |
|
|
{ |
|
|
*tagList=NULL; |
|
|
*numTags=0; |
|
|
Finley_Mesh* mesh=m_finleyMesh.get(); |
|
|
switch (functionSpaceType) { |
|
|
case(Nodes): |
|
|
if (mesh->Nodes!=NULL) { |
|
|
*tagList=mesh->Nodes->Tag; |
|
|
*numTags=mesh->Nodes->numNodes; |
|
|
} |
|
|
break; |
|
|
case(Elements): |
|
|
if (mesh->Elements!=NULL) { |
|
|
*tagList=mesh->Elements->Tag; |
|
|
*numTags=mesh->Elements->numElements; |
|
|
} |
|
|
break; |
|
|
case(FaceElements): |
|
|
if (mesh->FaceElements!=NULL) { |
|
|
*tagList=mesh->FaceElements->Tag; |
|
|
*numTags=mesh->FaceElements->numElements; |
|
|
} |
|
|
break; |
|
|
case(Points): |
|
|
if (mesh->Points!=NULL) { |
|
|
*tagList=mesh->Points->Tag; |
|
|
*numTags=mesh->Points->numElements; |
|
|
} |
|
|
break; |
|
|
case(ContactElementsZero): |
|
|
if (mesh->ContactElements!=NULL) { |
|
|
*tagList=mesh->ContactElements->Tag; |
|
|
*numTags=mesh->ContactElements->numElements; |
|
|
} |
|
|
break; |
|
|
case(ContactElementsOne): |
|
|
if (mesh->ContactElements!=NULL) { |
|
|
*tagList=mesh->ContactElements->Tag; |
|
|
*numTags=mesh->ContactElements->numElements; |
|
|
} |
|
|
break; |
|
|
case(DegreesOfFreedom): |
|
|
if (mesh->Nodes!=NULL) { |
|
|
*tagList=NULL; |
|
|
*numTags=0; |
|
|
} |
|
|
break; |
|
|
case(ReducedDegreesOfFreedom): |
|
|
if (mesh->Nodes!=NULL) { |
|
|
*tagList=NULL; |
|
|
*numTags=0; |
|
|
} |
|
|
break; |
|
|
default: |
|
|
stringstream temp; |
|
|
temp << "Error - Invalid function space type: " << functionSpaceType << " for domain: " << getDescription(); |
|
|
throw FinleyAdapterException(temp.str()); |
|
|
break; |
|
|
} |
|
|
if (*tagList==NULL) { |
|
|
stringstream temp; |
|
|
temp << "Error - no tags available for " << functionSpaceType << " for domain: " << getDescription(); |
|
|
throw FinleyAdapterException(temp.str()); |
|
|
} |
|
|
return; |
|
|
} |
|
|
|
|
|
// |
|
|
// returns a pointer to the reference no list of samples of functionSpaceType |
|
|
// |
|
|
void MeshAdapter::getReferenceNoList(int functionSpaceType, int** referenceNoList, |
|
|
int* numReferenceNo) const |
|
|
{ |
|
|
*referenceNoList=NULL; |
|
|
*numReferenceNo=0; |
|
|
Finley_Mesh* mesh=m_finleyMesh.get(); |
|
|
switch (functionSpaceType) { |
|
|
case(Nodes): |
|
|
if (mesh->Nodes!=NULL) { |
|
|
*referenceNoList=mesh->Nodes->Id; |
|
|
*numReferenceNo=mesh->Nodes->numNodes; |
|
|
} |
|
|
break; |
|
|
case(Elements): |
|
|
if (mesh->Elements!=NULL) { |
|
|
*referenceNoList=mesh->Elements->Id; |
|
|
*numReferenceNo=mesh->Elements->numElements; |
|
|
} |
|
|
break; |
|
|
case(FaceElements): |
|
|
if (mesh->FaceElements!=NULL) { |
|
|
*referenceNoList=mesh->FaceElements->Id; |
|
|
*numReferenceNo=mesh->FaceElements->numElements; |
|
|
} |
|
|
break; |
|
|
case(Points): |
|
|
if (mesh->Points!=NULL) { |
|
|
*referenceNoList=mesh->Points->Id; |
|
|
*numReferenceNo=mesh->Points->numElements; |
|
|
} |
|
|
break; |
|
|
case(ContactElementsZero): |
|
|
if (mesh->ContactElements!=NULL) { |
|
|
*referenceNoList=mesh->ContactElements->Id; |
|
|
*numReferenceNo=mesh->ContactElements->numElements; |
|
|
} |
|
|
break; |
|
|
case(ContactElementsOne): |
|
|
if (mesh->ContactElements!=NULL) { |
|
|
*referenceNoList=mesh->ContactElements->Id; |
|
|
*numReferenceNo=mesh->ContactElements->numElements; |
|
|
} |
|
|
break; |
|
|
case(DegreesOfFreedom): |
|
|
if (mesh->Nodes!=NULL) { |
|
|
*referenceNoList=NULL; |
|
|
*numReferenceNo=0; |
|
|
} |
|
|
break; |
|
|
case(ReducedDegreesOfFreedom): |
|
|
if (mesh->Nodes!=NULL) { |
|
|
*referenceNoList=NULL; |
|
|
*numReferenceNo=0; |
|
|
} |
|
|
break; |
|
|
default: |
|
|
stringstream temp; |
|
|
temp << "Error - Invalid function space type: " << functionSpaceType << " for domain: " << getDescription(); |
|
|
throw FinleyAdapterException(temp.str()); |
|
|
break; |
|
|
} |
|
|
if (*referenceNoList==NULL) { |
|
|
stringstream temp; |
|
|
temp << "Error - reference number list available for " << functionSpaceType << " for domain: " << getDescription(); |
|
|
throw FinleyAdapterException(temp.str()); |
|
|
} |
|
|
return; |
|
|
} |
|
|
|
|
|
// |
|
163 |
// return the spatial dimension of the Mesh: |
// return the spatial dimension of the Mesh: |
164 |
// |
// |
165 |
int MeshAdapter::getDim() const |
int MeshAdapter::getDim() const |
910 |
|
|
911 |
int MeshAdapter::getTagFromSampleNo(int functionSpaceType, int sampleNo) const |
int MeshAdapter::getTagFromSampleNo(int functionSpaceType, int sampleNo) const |
912 |
{ |
{ |
913 |
int* tagList; |
int out=0; |
914 |
int numTags; |
Finley_Mesh* mesh=m_finleyMesh.get(); |
915 |
getTagList(functionSpaceType, &tagList, &numTags); |
switch (functionSpaceType) { |
916 |
return tagList[sampleNo]; |
case(Nodes): |
917 |
|
out=mesh->Nodes->Tag[sampleNo]; |
918 |
|
break; |
919 |
|
case(Elements): |
920 |
|
out=mesh->Elements->Tag[sampleNo]; |
921 |
|
break; |
922 |
|
case(FaceElements): |
923 |
|
out=mesh->FaceElements->Tag[sampleNo]; |
924 |
|
break; |
925 |
|
case(Points): |
926 |
|
out=mesh->Points->Tag[sampleNo]; |
927 |
|
break; |
928 |
|
case(ContactElementsZero): |
929 |
|
out=mesh->ContactElements->Tag[sampleNo]; |
930 |
|
break; |
931 |
|
case(ContactElementsOne): |
932 |
|
out=mesh->ContactElements->Tag[sampleNo]; |
933 |
|
break; |
934 |
|
case(DegreesOfFreedom): |
935 |
|
break; |
936 |
|
case(ReducedDegreesOfFreedom): |
937 |
|
break; |
938 |
|
default: |
939 |
|
stringstream temp; |
940 |
|
temp << "Error - Invalid function space type: " << functionSpaceType << " for domain: " << getDescription(); |
941 |
|
throw FinleyAdapterException(temp.str()); |
942 |
|
break; |
943 |
|
} |
944 |
|
return out; |
945 |
} |
} |
|
|
|
946 |
int MeshAdapter::getReferenceNoFromSampleNo(int functionSpaceType, int sampleNo) const |
int MeshAdapter::getReferenceNoFromSampleNo(int functionSpaceType, int sampleNo) const |
947 |
{ |
{ |
948 |
int* referenceNoList; |
int out=0,i; |
949 |
int numReferenceNo; |
Finley_Mesh* mesh=m_finleyMesh.get(); |
950 |
getReferenceNoList(functionSpaceType, &referenceNoList, &numReferenceNo); |
switch (functionSpaceType) { |
951 |
return referenceNoList[sampleNo]; |
case(Nodes): |
952 |
|
if (mesh->Nodes!=NULL) { |
953 |
|
out=mesh->Nodes->Id[sampleNo]; |
954 |
|
break; |
955 |
|
} |
956 |
|
case(Elements): |
957 |
|
out=mesh->Elements->Id[sampleNo]; |
958 |
|
break; |
959 |
|
case(FaceElements): |
960 |
|
out=mesh->FaceElements->Id[sampleNo]; |
961 |
|
break; |
962 |
|
case(Points): |
963 |
|
out=mesh->Points->Id[sampleNo]; |
964 |
|
break; |
965 |
|
case(ContactElementsZero): |
966 |
|
out=mesh->ContactElements->Id[sampleNo]; |
967 |
|
break; |
968 |
|
case(ContactElementsOne): |
969 |
|
out=mesh->ContactElements->Id[sampleNo]; |
970 |
|
break; |
971 |
|
case(DegreesOfFreedom): |
972 |
|
for (i=0;i<mesh->Nodes->numNodes; ++i) { |
973 |
|
if (mesh->Nodes->degreeOfFreedom[i]==sampleNo) { |
974 |
|
out=mesh->Nodes->Id[i]; |
975 |
|
break; |
976 |
|
} |
977 |
|
} |
978 |
|
break; |
979 |
|
case(ReducedDegreesOfFreedom): |
980 |
|
for (i=0;i<mesh->Nodes->numNodes; ++i) { |
981 |
|
if (mesh->Nodes->reducedDegreeOfFreedom[i]==sampleNo) { |
982 |
|
out=mesh->Nodes->Id[i]; |
983 |
|
break; |
984 |
|
} |
985 |
|
} |
986 |
|
break; |
987 |
|
default: |
988 |
|
stringstream temp; |
989 |
|
temp << "Error - Invalid function space type: " << functionSpaceType << " for domain: " << getDescription(); |
990 |
|
throw FinleyAdapterException(temp.str()); |
991 |
|
break; |
992 |
|
} |
993 |
|
return out; |
994 |
} |
} |
995 |
|
|
996 |
} // end of namespace |
} // end of namespace |